> checkClasses() {
+ return RulesLists.getAllChecks();
+ }
+}
diff --git a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomPlugin.java b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomPlugin.java
index 86a189b5..15654b06 100644
--- a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomPlugin.java
+++ b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomPlugin.java
@@ -14,7 +14,9 @@ public void define(Context context) {
OpenAPICustomProfileDefinition.class,
OpenAPICustomRulesDefinition.class,
// batch extensions -> objects are instantiated during code analysis
- OpenAPICustomRuleRepository.class
+ OpenAPICustomRuleRepository.class,
+ OpenAPICustomJsonRuleRepository.class,
+ OpenAPICustomOpenApiRuleRepository.class
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinition.java b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinition.java
index 05996f96..9eb7d1f3 100644
--- a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinition.java
+++ b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinition.java
@@ -1,6 +1,7 @@
package apiaddicts.sonar.openapi;
import org.apiaddicts.apitools.dosonarapi.api.OpenApiCustomRuleRepository;
+import org.apiaddicts.apitools.dosonarapi.checks.CheckList;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
import org.sonar.api.utils.AnnotationUtils;
import org.sonar.check.Rule;
@@ -9,28 +10,40 @@
import javax.annotation.Nullable;
import java.util.List;
-/**
- * Declare a new quality profile that comprises all the custom rules, plus the SonarOpenApi standard rules.
- *
- * This allows to create a built-in profile that extends the Sonar Way profile, and that includes your rules.
- * This profile will automatically inherit any new rule brought in by the core plugin.
- */
public class OpenAPICustomProfileDefinition implements BuiltInQualityProfilesDefinition {
- public static final String MY_COMPANY_WAY = "Custom";
+ public static final String OPENAPI_WAY = "OpenAPI";
public OpenAPICustomProfileDefinition() {
this(null);
}
public OpenAPICustomProfileDefinition(@Nullable OpenApiCustomRuleRepository[] repositories) {
- // Intentional blank
+ // Intentional blank
}
@Override
public void define(Context context) {
- NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile(MY_COMPANY_WAY, "openapi");
- addRepositoryRules(profile, OpenAPICustomRulesDefinition.REPOSITORY_KEY, RulesLists.getAllChecks());
- profile.done();
+ NewBuiltInQualityProfile yamlProfile = context.createBuiltInQualityProfile(OPENAPI_WAY, "yaml");
+ addBaseRules(yamlProfile, CheckList.YAML_REPOSITORY_KEY);
+ addRepositoryRules(yamlProfile, OpenAPICustomRulesDefinition.YAML_REPOSITORY_KEY, RulesLists.getAllChecks());
+ yamlProfile.done();
+
+ NewBuiltInQualityProfile jsonProfile = context.createBuiltInQualityProfile(OPENAPI_WAY, "json");
+ addBaseRules(jsonProfile, CheckList.JSON_REPOSITORY_KEY);
+ addRepositoryRules(jsonProfile, OpenAPICustomRulesDefinition.JSON_REPOSITORY_KEY, RulesLists.getAllChecks());
+ jsonProfile.done();
+
+ NewBuiltInQualityProfile openapiProfile = context.createBuiltInQualityProfile(OPENAPI_WAY, CheckList.OPENAPI_LANGUAGE);
+ addBaseRules(openapiProfile, CheckList.OPENAPI_REPOSITORY_KEY);
+ addRepositoryRules(openapiProfile, OpenAPICustomRulesDefinition.OPENAPI_REPOSITORY_KEY, RulesLists.getAllChecks());
+ openapiProfile.done();
+ }
+
+ private void addBaseRules(NewBuiltInQualityProfile profile, String repositoryKey) {
+ for (Class> check : CheckList.getChecks()) {
+ Rule annotation = AnnotationUtils.getAnnotation(check, Rule.class);
+ profile.activateRule(repositoryKey, annotation.key());
+ }
}
private void addRepositoryRules(NewBuiltInQualityProfile profile, String key, List> checks) {
@@ -41,8 +54,8 @@ private void addRepositoryRules(NewBuiltInQualityProfile profile, String key, Li
}
}
}
-
+
private boolean isTemplateRule(String ruleKey) {
- return "OAR112".equals(ruleKey);
+ return "OAR112".equals(ruleKey);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepository.java b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepository.java
index ec1a3fc1..0310376e 100644
--- a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepository.java
+++ b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepository.java
@@ -8,7 +8,7 @@
import java.util.List;
-import static apiaddicts.sonar.openapi.OpenAPICustomRulesDefinition.REPOSITORY_KEY;
+import static apiaddicts.sonar.openapi.OpenAPICustomRulesDefinition.YAML_REPOSITORY_KEY;
/**
* Makes the rules visible to the OpenAPI scanner sensor,
@@ -22,7 +22,7 @@
public class OpenAPICustomRuleRepository implements OpenApiCustomRuleRepository {
@Override
public String repositoryKey() {
- return REPOSITORY_KEY;
+ return YAML_REPOSITORY_KEY;
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinition.java b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinition.java
index a51ab94f..a0dff556 100644
--- a/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinition.java
+++ b/src/main/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinition.java
@@ -15,7 +15,9 @@
@ScannerSide
@ExtensionPoint
public class OpenAPICustomRulesDefinition implements RulesDefinition {
- public static final String REPOSITORY_KEY = "openapi-custom";
+ public static final String YAML_REPOSITORY_KEY = "openapi-custom-yaml";
+ public static final String JSON_REPOSITORY_KEY = "openapi-custom-json";
+ public static final String OPENAPI_REPOSITORY_KEY = "openapi-custom";
private static final String REPOSITORY_NAME = "OpenAPI Custom";
private static final String ROOT_RESOURCE_FOLDER = "org/sonar/l10n/openapi/rules/openapi/";
private static final String SECURITY_GROUP = "security";
@@ -31,11 +33,16 @@ public class OpenAPICustomRulesDefinition implements RulesDefinition {
@Override
public void define(Context context) {
I18nContext.initializeFromUserLanguage();
+ populateRepository(context, YAML_REPOSITORY_KEY, "yaml");
+ populateRepository(context, JSON_REPOSITORY_KEY, "json");
+ populateRepository(context, OPENAPI_REPOSITORY_KEY, "openapi");
+ }
+
+ private void populateRepository(Context context, String key, String language) {
NewRepository repository = context
- .createRepository(REPOSITORY_KEY, "openapi")
+ .createRepository(key, language)
.setName(REPOSITORY_NAME);
- // Carga de reglas para cada grupo
new RuleMetadataLoader(getPath(SECURITY_GROUP)).addRulesByAnnotatedClass(repository, RulesLists.getSecurityChecks());
new RuleMetadataLoader(getPath(FORMAT_GROUP)).addRulesByAnnotatedClass(repository, RulesLists.getFormatChecks());
new RuleMetadataLoader(getPath(SCHEMAS_GROUP)).addRulesByAnnotatedClass(repository, RulesLists.getSchemasChecks());
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractPatternWso2ScopesCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractPatternWso2ScopesCheck.java
index ce651971..fb482421 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractPatternWso2ScopesCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractPatternWso2ScopesCheck.java
@@ -2,6 +2,7 @@
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
+import java.util.List;
import java.util.regex.Pattern;
public abstract class AbstractPatternWso2ScopesCheck extends AbstractWso2ScopesCheck {
@@ -29,11 +30,22 @@ protected void visitFile(JsonNode root) {
@Override
protected void visitScope(JsonNode scope) {
JsonNode fieldNode = scope.propertyMap().get(fieldName);
- if (fieldNode == null || fieldNode.isNull() || fieldNode.isMissing()) return;
-
- String fieldText = fieldNode.getTokenValue();
- boolean notValid = !pattern.matcher(fieldText).matches();
-
- if (notValid) addIssue(ruleKey, translate(messageKey), fieldNode.value());
+ if (fieldNode == null || fieldNode.isNull() || fieldNode.isMissing())
+ return;
+
+ List elements = fieldNode.elements();
+ if (!elements.isEmpty()) {
+ for (JsonNode element : elements) {
+ String roleText = element.getTokenValue();
+ if (roleText != null && !pattern.matcher(roleText).matches()) {
+ addIssue(ruleKey, translate(messageKey), element);
+ }
+ }
+ } else {
+ String fieldText = fieldNode.getTokenValue();
+ if (fieldText != null && !pattern.matcher(fieldText).matches()) {
+ addIssue(ruleKey, translate(messageKey), fieldNode);
+ }
+ }
}
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2OperationCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2OperationCheck.java
index a8b4c7f0..7a4d7496 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2OperationCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2OperationCheck.java
@@ -5,6 +5,8 @@
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -15,7 +17,9 @@ public abstract class AbstractWso2OperationCheck extends BaseCheck {
public Set subscribedKinds() {
return ImmutableSet.of(
OpenApi2Grammar.OPERATION,
- OpenApi3Grammar.OPERATION
+ OpenApi3Grammar.OPERATION,
+ OpenApi31Grammar.OPERATION,
+ OpenApi32Grammar.OPERATION
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2ScopesCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2ScopesCheck.java
index c1bf9f0e..e87b71ff 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2ScopesCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/apim/wso2/AbstractWso2ScopesCheck.java
@@ -4,6 +4,8 @@
import com.sonar.sslr.api.AstNodeType;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -14,7 +16,7 @@ public abstract class AbstractWso2ScopesCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheck.java
index b1d0582a..e63b1aed 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheck.java
@@ -12,6 +12,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
@@ -35,17 +36,18 @@ public Set subscribedKinds() {
OpenApi2Grammar.SCHEMA, OpenApi2Grammar.RESPONSES, OpenApi2Grammar.PARAMETER,
OpenApi3Grammar.SCHEMA, OpenApi3Grammar.RESPONSES, OpenApi3Grammar.PARAMETER,
OpenApi31Grammar.SCHEMA, OpenApi31Grammar.RESPONSES, OpenApi31Grammar.PARAMETER,
- OpenApi3Grammar.REQUEST_BODY, OpenApi31Grammar.REQUEST_BODY,
- OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH
+ OpenApi32Grammar.SCHEMA, OpenApi32Grammar.RESPONSES, OpenApi32Grammar.PARAMETER,
+ OpenApi3Grammar.REQUEST_BODY, OpenApi31Grammar.REQUEST_BODY, OpenApi32Grammar.REQUEST_BODY,
+ OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH
);
}
@Override
public void visitNode(JsonNode node) {
AstNodeType type = node.getType();
- if (OpenApi2Grammar.PATH.equals(type) || OpenApi3Grammar.PATH.equals(type) || OpenApi31Grammar.PATH.equals(type)) {
+ if (OpenApi2Grammar.PATH.equals(type) || OpenApi3Grammar.PATH.equals(type) || OpenApi31Grammar.PATH.equals(type) || OpenApi32Grammar.PATH.equals(type)) {
visitPathNode(node);
- } else if (OpenApi2Grammar.PARAMETER.equals(type) || OpenApi3Grammar.PARAMETER.equals(type) || OpenApi31Grammar.PARAMETER.equals(type)) {
+ } else if (OpenApi2Grammar.PARAMETER.equals(type) || OpenApi3Grammar.PARAMETER.equals(type) || OpenApi31Grammar.PARAMETER.equals(type) || OpenApi32Grammar.PARAMETER.equals(type)) {
visitParameterNode(node);
} else if (type.equals(OpenApi2Grammar.RESPONSES) || type.equals(OpenApi2Grammar.SCHEMA)) {
visitV2Node(node);
@@ -98,11 +100,11 @@ private void visitResponseV2Node(JsonNode node) {
private void visitV3Node(JsonNode node) {
AstNodeType type = node.getType();
- if (OpenApi3Grammar.RESPONSES.equals(type)) {
+ if (OpenApi3Grammar.RESPONSES.equals(type) || OpenApi31Grammar.RESPONSES.equals(type) || OpenApi32Grammar.RESPONSES.equals(type)) {
processResponses(node, this::visitRequestBodyOrResponseV3Node);
- } else if (OpenApi3Grammar.SCHEMA.equals(type)) {
+ } else if (OpenApi3Grammar.SCHEMA.equals(type) || OpenApi31Grammar.SCHEMA.equals(type) || OpenApi32Grammar.SCHEMA.equals(type)) {
visitSchemaNode(node);
- } else if (OpenApi3Grammar.REQUEST_BODY.equals(type)) {
+ } else if (OpenApi3Grammar.REQUEST_BODY.equals(type) || OpenApi31Grammar.REQUEST_BODY.equals(type) || OpenApi32Grammar.REQUEST_BODY.equals(type)) {
visitRequestBodyOrResponseV3Node(node);
}
}
@@ -118,7 +120,7 @@ private void visitRequestBodyOrResponseV3Node(JsonNode node) {
JsonNode content = node.at("/content");
if (content.isMissing()) {
- String errorKey = node.getType().equals(OpenApi3Grammar.REQUEST_BODY) ? "OAR031.error-request" : ERROR_RESPONSE;
+ String errorKey = (node.getType().equals(OpenApi3Grammar.REQUEST_BODY) || node.getType().equals(OpenApi31Grammar.REQUEST_BODY) || node.getType().equals(OpenApi32Grammar.REQUEST_BODY)) ? "OAR031.error-request" : ERROR_RESPONSE;
addIssue(KEY, translate(errorKey), handleExternalRef.getTrueNode(node.key()));
return;
}
@@ -129,7 +131,7 @@ private void visitRequestBodyOrResponseV3Node(JsonNode node) {
|| !mediaTypeNode.get(EXAMPLE).isMissing();
if (!hasExplicitExample && !isSchemaCovered(schemaNode)) {
- String errorKey = node.getType().equals(OpenApi3Grammar.REQUEST_BODY) ? "OAR031.error-request" : ERROR_RESPONSE;
+ String errorKey = (node.getType().equals(OpenApi3Grammar.REQUEST_BODY) || node.getType().equals(OpenApi31Grammar.REQUEST_BODY) || node.getType().equals(OpenApi32Grammar.REQUEST_BODY)) ? "OAR031.error-request" : ERROR_RESPONSE;
addIssue(KEY, translate(errorKey), handleExternalRef.getTrueNode(node.key()));
}
}
@@ -160,12 +162,14 @@ private boolean isSchemaCovered(JsonNode schemaNode) {
private void visitSchemaNode(JsonNode node) {
JsonNode parentNode = (JsonNode) node.getParent().getParent();
- if (parentNode.getType().equals(OpenApi3Grammar.PARAMETER)) {
+ if (parentNode.getType().equals(OpenApi3Grammar.PARAMETER) || parentNode.getType().equals(OpenApi31Grammar.PARAMETER) || parentNode.getType().equals(OpenApi32Grammar.PARAMETER)) {
return;
}
if (parentNode.getType().equals(OpenApi3Grammar.SCHEMA_PROPERTIES)
- || parentNode.getType().toString().equals("BLOCK_MAPPING")
+ || parentNode.getType().equals(OpenApi31Grammar.SCHEMA_PROPERTIES)
+ || parentNode.getType().equals(OpenApi32Grammar.SCHEMA_PROPERTIES)
+ || parentNode.getType().toString().equals("BLOCK_MAPPING")
|| parentNode.getType().toString().equals("FLOW_MAPPING")) {
JsonNode schemaParent = (JsonNode) parentNode.getParent().getParent();
@@ -190,7 +194,7 @@ private void visitPathNode(JsonNode node) {
.forEach(response -> handleExternalRef.resolve(response, resolved -> {
if (resolved.getType().equals(OpenApi2Grammar.RESPONSE)) {
visitSchemaNode2(resolved);
- } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE)) {
+ } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE) || resolved.getType().equals(OpenApi31Grammar.RESPONSE) || resolved.getType().equals(OpenApi32Grammar.RESPONSE)) {
JsonNode content = resolved.at("/content");
if (!content.isMissing()) {
content.propertyMap().forEach((mediaType, mediaTypeNode) -> {
@@ -212,7 +216,8 @@ private void visitSchemaNode2(JsonNode responseNode) {
if (props.isMissing() || !props.isObject()) return;
props.propertyMap().forEach((key, propertyNode) -> {
- if (propertyNode.get(EXAMPLE).isMissing()) {
+ JsonNode type = getType(propertyNode);
+ if (!type.isMissing() && !isObjectType(type) && !isArrayType(type) && !isSchemaCovered(propertyNode)) {
addIssue(KEY, translate("OAR031.error-property"), handleExternalRef.getTrueNode(propertyNode.key()));
}
});
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheck.java
index ca1c4eb0..4c34f582 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import apiaddicts.sonar.openapi.utils.ExternalRefHandler;
@@ -26,15 +27,15 @@ public class OAR094UseExamplesCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType())) {
+ if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType()) || OpenApi32Grammar.ROOT.equals(node.getType())) {
deepSearchForExample(node);
}
- if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType()) || OpenApi31Grammar.PATH.equals(node.getType())) {
+ if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType()) || OpenApi31Grammar.PATH.equals(node.getType()) || OpenApi32Grammar.PATH.equals(node.getType())) {
visitPathNode(node);
}
}
@@ -60,7 +61,7 @@ private void visitPathNode(JsonNode node) {
.forEach(response -> handleExternalRef.resolve(response, resolved -> {
if (resolved.getType().equals(OpenApi2Grammar.RESPONSE)) {
visitSchemaNode(resolved);
- } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE)) {
+ } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE) || resolved.getType().equals(OpenApi31Grammar.RESPONSE) || resolved.getType().equals(OpenApi32Grammar.RESPONSE)) {
JsonNode content = resolved.at("/content");
if (!content.isMissing()) {
content.propertyMap().forEach((mediaType, mediaTypeNode) -> {
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractBasePathCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractBasePathCheck.java
index ef1358fe..35bc151d 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractBasePathCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractBasePathCheck.java
@@ -12,6 +12,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
public abstract class AbstractBasePathCheck extends BaseCheck {
@@ -24,7 +25,7 @@ protected AbstractBasePathCheck(String ruleKey) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.SERVER, OpenApi31Grammar.SERVER);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.SERVER, OpenApi31Grammar.SERVER, OpenApi32Grammar.SERVER);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java
index 3a621ca6..1da0417d 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java
@@ -13,6 +13,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.RuleProperty;
@@ -50,7 +51,7 @@ protected AbstractDefaultMediaTypeCheck(String key, String section, String messa
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES, OpenApi32Grammar.RESPONSES);
}
@Override
@@ -93,13 +94,13 @@ private void visitV2Node(JsonNode node) {
}
private void visitV3Node(JsonNode node) {
-
- if (node.getType() == OpenApi3Grammar.OPERATION && section.equals("consumes")) {
+ AstNodeType type = node.getType();
+ if ((type == OpenApi3Grammar.OPERATION || type == OpenApi31Grammar.OPERATION || type == OpenApi32Grammar.OPERATION) && section.equals("consumes")) {
handleConsumesOperation(node);
return;
}
- if (node.getType() == OpenApi3Grammar.RESPONSES && section.equals("produces")) {
+ if ((type == OpenApi3Grammar.RESPONSES || type == OpenApi31Grammar.RESPONSES || type == OpenApi32Grammar.RESPONSES) && section.equals("produces")) {
MediaTypeUtils.handleProducesResponses(node, externalRefNode, this::visitContentNode);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractFormatCheck.java
index b163c2fd..5d4d728b 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractFormatCheck.java
@@ -5,6 +5,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -14,7 +15,7 @@ public abstract class AbstractFormatCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.SCHEMA, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA);
+ return ImmutableSet.of(OpenApi2Grammar.SCHEMA, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA, OpenApi32Grammar.SCHEMA);
}
@Override
@@ -26,8 +27,13 @@ private void visitV2Node(JsonNode node) {
JsonNode typeNode = node.get("type");
String type = typeNode.getTokenValue();
JsonNode formatNode = node.get("format");
- String format = formatNode.isMissing() ? null : formatNode.getTokenValue();
- validate(type, format, typeNode);
+ if (formatNode.isMissing()) {
+ validate(type, null, typeNode);
+ return;
+ }
+ String format = formatNode.getTokenValue();
+ if (format == null || format.isBlank()) return;
+ validate(type, format.trim(), typeNode);
}
public abstract void validate(String type, String format, JsonNode typeNode);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractInfoObjectMappingCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractInfoObjectMappingCheck.java
index 82b50705..b8fa9d64 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractInfoObjectMappingCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractInfoObjectMappingCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.List;
@@ -32,7 +33,8 @@ public Set subscribedKinds() {
return ImmutableSet.of(
OpenApi2Grammar.INFO,
OpenApi3Grammar.INFO,
- OpenApi31Grammar.INFO
+ OpenApi31Grammar.INFO,
+ OpenApi32Grammar.INFO
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractSchemaNamingConventionCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractSchemaNamingConventionCheck.java
index 11e89f24..8b527c02 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractSchemaNamingConventionCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractSchemaNamingConventionCheck.java
@@ -9,6 +9,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.isOperation;
@@ -25,16 +26,16 @@ protected AbstractSchemaNamingConventionCheck(String key, String message, String
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi2Grammar.PATH,
- OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS, OpenApi2Grammar.PATH,
+ OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
- if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType())) {
+ if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType()) || OpenApi31Grammar.PATH.equals(node.getType()) || OpenApi32Grammar.PATH.equals(node.getType())) {
visitPathNode(node);
}
}
@@ -107,6 +108,7 @@ private void visitSchemaNode(JsonNode schemaNode) {
JsonNode nameNode = property.key();
String name = nameNode.getTokenValue();
validateNamingConvention(name, nameNode);
+ visitSchemaNode(property);
}
}
}
@@ -121,7 +123,7 @@ private void visitPathNode(JsonNode node) {
.forEach(response -> handleExternalRef.resolve(response, resolved -> {
if (resolved.getType().equals(OpenApi2Grammar.RESPONSE)) {
visitSchemaNode2(resolved);
- } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE)) {
+ } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE) || resolved.getType().equals(OpenApi31Grammar.RESPONSE) || resolved.getType().equals(OpenApi32Grammar.RESPONSE)) {
JsonNode content = resolved.at("/content");
if (!content.isMissing()) {
content.propertyMap().forEach((mediaType, mediaTypeNode) -> {
@@ -144,7 +146,10 @@ private void visitSchemaNode2(JsonNode responseOrMediaTypeNode) {
JsonNode propsNode = schemaResolved.get(PROPERTIES);
if (!propsNode.isMissing() && propsNode.isObject()) {
propsNode.propertyMap()
- .forEach((name, property) -> validateNamingConvention(name, handleExternalRef.getTrueNode(property.key())));
+ .forEach((name, property) -> {
+ validateNamingConvention(name, handleExternalRef.getTrueNode(property.key()));
+ visitSchemaNode(property);
+ });
}
});
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java
index 04ce8a73..7812a758 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java
@@ -10,6 +10,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
public abstract class AbstractUndefinedMediaTypeCheck extends BaseCheck {
@@ -28,7 +29,7 @@ protected AbstractUndefinedMediaTypeCheck(String key, String section) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES, OpenApi32Grammar.RESPONSES);
}
@Override
@@ -59,12 +60,13 @@ private void visitV2Node(JsonNode node) {
}
private void visitV3Node(JsonNode node) {
- if (node.getType() == OpenApi3Grammar.OPERATION && section.equals("consumes")) {
+ AstNodeType type = node.getType();
+ if ((type == OpenApi3Grammar.OPERATION || type == OpenApi31Grammar.OPERATION || type == OpenApi32Grammar.OPERATION) && section.equals("consumes")) {
handleConsumesOperation(node);
return;
}
- if (node.getType() == OpenApi3Grammar.RESPONSES && section.equals("produces")) {
+ if ((type == OpenApi3Grammar.RESPONSES || type == OpenApi31Grammar.RESPONSES || type == OpenApi32Grammar.RESPONSES) && section.equals("produces")) {
MediaTypeUtils.handleProducesResponses(node, externalRefNode, this::visitContentNode);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheck.java
index da4525c1..349f2093 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheck.java
@@ -8,6 +8,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.net.MalformedURLException;
@@ -35,7 +36,7 @@ public OAR011UrlNamingConventionCheck() {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi2Grammar.PATH, OpenApi3Grammar.SERVER, OpenApi3Grammar.PATH, OpenApi31Grammar.SERVER, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi2Grammar.PATH, OpenApi3Grammar.SERVER, OpenApi3Grammar.PATH, OpenApi31Grammar.SERVER, OpenApi31Grammar.PATH, OpenApi32Grammar.SERVER, OpenApi32Grammar.PATH);
}
@Override
@@ -56,7 +57,7 @@ private void visitV2Node(JsonNode node) {
}
private void visitV3Node(JsonNode node) {
- if (node.is(OpenApi3Grammar.SERVER)) {
+ if (node.is(OpenApi3Grammar.SERVER) || node.is(OpenApi31Grammar.SERVER) || node.is(OpenApi32Grammar.SERVER)) {
visitV3ServerNode(node);
} else {
visitPathNode(node);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheck.java
index 07492204..8f4d7c9f 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheck.java
@@ -7,6 +7,8 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -36,13 +38,18 @@ public OAR012ParameterNamingConventionCheck() {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi2Grammar.SCHEMA, OpenApi3Grammar.PARAMETER,
- OpenApi3Grammar.SCHEMA);
+ return ImmutableSet.of(
+ OpenApi2Grammar.PARAMETER, OpenApi2Grammar.SCHEMA,
+ OpenApi3Grammar.PARAMETER, OpenApi3Grammar.SCHEMA,
+ OpenApi31Grammar.PARAMETER, OpenApi31Grammar.SCHEMA,
+ OpenApi32Grammar.PARAMETER, OpenApi32Grammar.SCHEMA);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PARAMETER.equals(node.getType()) || OpenApi3Grammar.PARAMETER.equals(node.getType())) {
+ AstNodeType type = node.getType();
+ if (OpenApi2Grammar.PARAMETER.equals(type) || OpenApi3Grammar.PARAMETER.equals(type)
+ || OpenApi31Grammar.PARAMETER.equals(type) || OpenApi32Grammar.PARAMETER.equals(type)) {
visitParameterNode(node);
} else {
visitSchemaNode(node);
@@ -50,7 +57,8 @@ public void visitNode(JsonNode node) {
}
private void visitSchemaNode(JsonNode schemaNode) {
- if (schemaNode.getType().equals(OpenApi3Grammar.REF))
+ AstNodeType type = schemaNode.getType();
+ if (OpenApi3Grammar.REF.equals(type) || OpenApi31Grammar.REF.equals(type) || OpenApi32Grammar.REF.equals(type))
schemaNode = resolve(schemaNode);
Map properties = schemaNode.propertyMap();
@@ -74,4 +82,4 @@ private void visitParameterNode(JsonNode node) {
validateNamingConvention(name, nameNode);
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheck.java
index 9605a6e5..72ebeaeb 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheck.java
@@ -12,7 +12,7 @@ public class OAR037StringFormatCheck extends AbstractFormatCheck {
public static final String KEY = "OAR037";
private static final String MESSAGE = "OAR037.error";
- private static final String DEFAULT_FORMATS_ALLOWED = "date,date-time,password,byte,binary,email,uuid,uri,hostname,ipv4,ipv6,HEX,HEX(16)";
+ private static final String DEFAULT_FORMATS_ALLOWED = "date,date-time,password,byte,binary,email,uuid,uri,hostname,ipv4,ipv6,HEX,HEX(16),json,xml,base64";
@RuleProperty(
key = "formats-allowed",
@@ -33,6 +33,6 @@ public void validate(String type, String format, JsonNode typeNode) {
}
private boolean isInvalidString(String type, String format, Set validFormats) {
- return "string".equals(type) && (format != null && !validFormats.contains(format.toLowerCase()));
+ return "string".equals(type) && (format == null || !validFormats.contains(format.toLowerCase()));
}
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheck.java
index c747e49e..aa7992ef 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheck.java
@@ -26,6 +26,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.utils.ExternalRefHandler;
@@ -60,7 +61,7 @@ public class OAR044MediaTypeCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.ROOT, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi3Grammar.RESPONSE, OpenApi3Grammar.RESPONSES, OpenApi3Grammar.REQUEST_BODY, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi31Grammar.REQUEST_BODY, OpenApi31Grammar.RESPONSE);
+ return Sets.newHashSet(OpenApi2Grammar.ROOT, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi3Grammar.RESPONSE, OpenApi3Grammar.RESPONSES, OpenApi3Grammar.REQUEST_BODY, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi31Grammar.REQUEST_BODY, OpenApi31Grammar.RESPONSE, OpenApi31Grammar.RESPONSES, OpenApi31Grammar.OPERATION, OpenApi32Grammar.PARAMETER, OpenApi32Grammar.REQUEST_BODY, OpenApi32Grammar.RESPONSE, OpenApi32Grammar.RESPONSES, OpenApi32Grammar.OPERATION);
}
@Override
@@ -88,17 +89,17 @@ private void verifyMimeTypeArray(JsonNode node) {
private void visitOpenApi3(JsonNode node) {
AstNodeType type = node.getType();
- if (type == OpenApi3Grammar.PARAMETER) {
+ if (type == OpenApi3Grammar.PARAMETER || type == OpenApi31Grammar.PARAMETER || type == OpenApi32Grammar.PARAMETER) {
verifyParameterContent(node);
- } else if (type == OpenApi3Grammar.RESPONSES) {
+ } else if (type == OpenApi3Grammar.RESPONSES || type == OpenApi31Grammar.RESPONSES || type == OpenApi32Grammar.RESPONSES) {
node.properties().forEach(responseNode -> {
if (!"204".equals(responseNode.key().getTokenValue())) {
handleExternalRef.resolve(responseNode, this::verifyContent);
}
});
- } else if (type == OpenApi3Grammar.OPERATION) {
+ } else if (type == OpenApi3Grammar.OPERATION || type == OpenApi31Grammar.OPERATION || type == OpenApi32Grammar.OPERATION) {
String op = node.key().getTokenValue().toLowerCase();
if (new HashSet<>(Arrays.asList("post", "put", "patch")).contains(op)) {
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheck.java
index 56ac487f..ae80959e 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheck.java
@@ -25,6 +25,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -36,7 +37,7 @@ public class OAR050ProvideOpSummaryCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheck.java
index da2aaee9..e86d24d0 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheck.java
@@ -25,6 +25,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -36,7 +37,7 @@ public class OAR051DescriptionDiffersSummaryCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheck.java
index d67c1608..d59492b7 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheck.java
@@ -1,6 +1,7 @@
package apiaddicts.sonar.openapi.checks.format;
import org.sonar.check.Rule;
+import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@Rule(key = OAR066SnakeCaseNamingConventionCheck.KEY)
public class OAR066SnakeCaseNamingConventionCheck extends AbstractSchemaNamingConventionCheck {
@@ -11,4 +12,10 @@ public class OAR066SnakeCaseNamingConventionCheck extends AbstractSchemaNamingCo
public OAR066SnakeCaseNamingConventionCheck() {
super(KEY, MESSAGE, SNAKE_CASE);
}
+
+ @Override
+ protected void validateNamingConvention(String name, JsonNode nameNode) {
+ if (name.startsWith("@") || name.startsWith("x-")) return;
+ super.validateNamingConvention(name, nameNode);
+ }
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheck.java
index fbfae9b1..c2647a9c 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -23,12 +24,12 @@ public OAR077ParametersInQuerySnakeCaseCheck() {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheck.java
index 117dd457..7552ee40 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheck.java
@@ -5,6 +5,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.*;
@@ -29,19 +30,19 @@ public class OAR086DescriptionFormatCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT, OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType())) {
+ if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType()) || OpenApi32Grammar.ROOT.equals(node.getType())) {
checkInfoDescription(node);
checkDefinitionsDescription(node);
}
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType())|| OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
- if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType()) || OpenApi31Grammar.PATH.equals(node.getType())) {
+ if (OpenApi2Grammar.PATH.equals(node.getType()) || OpenApi3Grammar.PATH.equals(node.getType()) || OpenApi31Grammar.PATH.equals(node.getType()) || OpenApi32Grammar.PATH.equals(node.getType())) {
visitPathNode(node);
}
}
@@ -112,9 +113,10 @@ private void visitPathNode(JsonNode node) {
.filter(responses -> !responses.isMissing())
.flatMap(responses -> responses.propertyMap().values().stream())
.forEach(response -> handleExternalRef.resolve(response, resolved -> {
- if (resolved.getType().equals(OpenApi2Grammar.RESPONSE)) {
+ AstNodeType responseType = resolved.getType();
+ if (responseType.equals(OpenApi2Grammar.RESPONSE)) {
visitSchemaNode(resolved);
- } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE)) {
+ } else if (responseType.equals(OpenApi3Grammar.RESPONSE) || responseType.equals(OpenApi31Grammar.RESPONSE) || responseType.equals(OpenApi32Grammar.RESPONSE)) {
resolved.at("/content").propertyMap().forEach((mediaType, mediaTypeNode) -> {
if (mediaType.toLowerCase().contains("json")) visitSchemaNode(mediaTypeNode);
});
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheck.java
index 6c1f81a7..697ffb63 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheck.java
@@ -5,6 +5,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -20,16 +21,16 @@ public class OAR087SummaryFormatCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT, OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType())) {
+ if (OpenApi2Grammar.ROOT.equals(node.getType()) || OpenApi3Grammar.ROOT.equals(node.getType()) || OpenApi31Grammar.ROOT.equals(node.getType()) || OpenApi32Grammar.ROOT.equals(node.getType())) {
checkInfoSummary(node);
checkDefinitionsSummary(node);
}
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheck.java
index 2b3da78b..e94c9636 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -28,12 +29,12 @@ public class OAR088RefParamCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheck.java
index 772c6bea..6fd8acea 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheck.java
@@ -6,6 +6,7 @@
import org.sonar.check.RuleProperty;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -27,12 +28,12 @@ public class OAR089RefRequestBodyCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS);
+ return ImmutableSet.of(OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheck.java
index 88bb914d..9c1f815a 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -28,7 +29,7 @@ public class OAR090RefResponseCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheck.java
index a8eed149..2dd78a64 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheck.java
@@ -9,6 +9,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -62,7 +63,15 @@ public Set subscribedKinds() {
OpenApi31Grammar.PARAMETER,
OpenApi31Grammar.RESPONSE,
OpenApi31Grammar.SCHEMA,
- OpenApi31Grammar.HEADER
+ OpenApi31Grammar.HEADER,
+ OpenApi32Grammar.OPERATION,
+ OpenApi32Grammar.PATHS,
+ OpenApi32Grammar.PATH,
+ OpenApi32Grammar.COMPONENTS,
+ OpenApi32Grammar.PARAMETER,
+ OpenApi32Grammar.RESPONSE,
+ OpenApi32Grammar.SCHEMA,
+ OpenApi32Grammar.HEADER
);
}
@@ -76,29 +85,32 @@ private void manageOperationAndResponse(JsonNode node, Set locations) {
AstNodeType type = node.getType();
String nodeKey = node.key().getTokenValue();
- if (isType(type, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION)) {
+ if (isType(type, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION)) {
String op = nodeKey.toLowerCase();
if (locations.contains("operation") || locations.contains("operation_" + op)) {
checkRequiredFieldInNode(node);
}
- } else if (isType(type, OpenApi2Grammar.RESPONSE, OpenApi3Grammar.RESPONSE, OpenApi31Grammar.RESPONSE)) {
+ } else if (isType(type, OpenApi2Grammar.RESPONSE, OpenApi3Grammar.RESPONSE, OpenApi31Grammar.RESPONSE, OpenApi32Grammar.RESPONSE)) {
if (locations.contains("response") || locations.contains("response_" + nodeKey)) {
checkRequiredFieldInNode(node);
}
+ } else if (isType(type, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH)) {
+ verifyParameter(node, locations, "path");
+ } else if (isType(type, OpenApi2Grammar.SCHEMA, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA, OpenApi32Grammar.SCHEMA)) {
+ verifyParameter(node, locations, "schema");
+ } else if (isType(type, OpenApi2Grammar.HEADER, OpenApi3Grammar.HEADER, OpenApi31Grammar.HEADER, OpenApi32Grammar.HEADER)) {
+ verifyParameter(node, locations, "header");
+ } else if (isType(type, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi32Grammar.PARAMETER)) {
+ verifyParameter(node, locations, "parameter");
}
- else if (isType(type, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH)) verifyParameter(node, locations, "path");
- else if (isType(type, OpenApi2Grammar.SCHEMA, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA)) verifyParameter(node, locations, "schema");
- else if (isType(type, OpenApi2Grammar.HEADER, OpenApi3Grammar.HEADER, OpenApi31Grammar.HEADER)) verifyParameter(node, locations, "header");
- else if (isType(type, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER)) verifyParameter(node, locations, "parameter");
-
if (locations.contains(nodeKey)) {
checkRequiredFieldInNode(node);
}
}
- private void verifyParameter(JsonNode node,Set locations ,String target){
- if(locations.contains(target))
+ private void verifyParameter(JsonNode node, Set locations, String target) {
+ if (locations.contains(target))
checkRequiredFieldInNode(node);
}
@@ -110,7 +122,6 @@ private void checkRequiredFieldInNode(JsonNode rootNode) {
}
}
-
private boolean isExtension(String field) {
return field != null && field.startsWith("x-");
}
@@ -121,7 +132,6 @@ private boolean isType(AstNodeType nodeType, AstNodeType... types) {
private void checkExtension(JsonNode node, String extension) {
boolean extensionExists = node.propertyMap().containsKey(extension);
-
if (!extensionExists) {
addIssue(KEY, translate("OAR113.error", extension), node.key());
}
@@ -133,5 +143,4 @@ private void checkStandardField(JsonNode node, String field) {
addIssue(KEY, translate("OAR113.error", field), node.key());
}
}
-
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFields.java b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFields.java
index fd39de30..235065ec 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFields.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFields.java
@@ -10,6 +10,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
@@ -22,12 +23,12 @@ public class OAR115VerifyRequiredFields extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.SCHEMA,OpenApi2Grammar.RESPONSE, OpenApi3Grammar.SCHEMA,OpenApi31Grammar.SCHEMA,OpenApi3Grammar.RESPONSE, OpenApi31Grammar.RESPONSE);
+ return ImmutableSet.of(OpenApi2Grammar.SCHEMA, OpenApi2Grammar.RESPONSE, OpenApi3Grammar.SCHEMA, OpenApi3Grammar.RESPONSE, OpenApi31Grammar.SCHEMA, OpenApi31Grammar.RESPONSE, OpenApi32Grammar.SCHEMA, OpenApi32Grammar.RESPONSE);
}
@Override
public void visitNode(JsonNode node) {
- if(node.getType() == OpenApi3Grammar.RESPONSE || node.getType() == OpenApi31Grammar.RESPONSE ){
+ if(node.getType() == OpenApi3Grammar.RESPONSE || node.getType() == OpenApi31Grammar.RESPONSE || node.getType() == OpenApi32Grammar.RESPONSE){
JsonNode content = node.get("content");
JsonNode json = content.get("application/json");
JsonNode schema = json.get("schema");
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractHttpMethodCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractHttpMethodCheck.java
index 9713db8a..e7f77304 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractHttpMethodCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractHttpMethodCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.RuleProperty;
@@ -84,16 +85,16 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
return ImmutableSet.of(
- OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH,
- OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION
+ OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH,
+ OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION
);
}
@Override
public void visitNode(JsonNode node) {
- if (node.getType() == OpenApi2Grammar.PATH || node.getType() == OpenApi3Grammar.PATH || node.getType() == OpenApi31Grammar.PATH) {
+ if (node.getType() == OpenApi2Grammar.PATH || node.getType() == OpenApi3Grammar.PATH || node.getType() == OpenApi31Grammar.PATH || node.getType() == OpenApi32Grammar.PATH) {
currentPath = node.key().getTokenValue();
- } else if (node.getType() == OpenApi2Grammar.OPERATION || node.getType() == OpenApi3Grammar.OPERATION || node.getType() == OpenApi31Grammar.OPERATION) {
+ } else if (node.getType() == OpenApi2Grammar.OPERATION || node.getType() == OpenApi3Grammar.OPERATION || node.getType() == OpenApi31Grammar.OPERATION || node.getType() == OpenApi32Grammar.OPERATION) {
if (shouldExcludePath()) {
return;
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourceLevelCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourceLevelCheck.java
index b85c8ada..ac94b477 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourceLevelCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourceLevelCheck.java
@@ -2,16 +2,15 @@
import com.google.common.collect.ImmutableSet;
import com.sonar.sslr.api.AstNodeType;
-import java.util.regex.Matcher;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
-import java.util.regex.Pattern;
import java.util.stream.Stream;
public abstract class AbstractResourceLevelCheck extends BaseCheck {
@@ -26,31 +25,22 @@ protected AbstractResourceLevelCheck(String key) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
- visitV2Node(node);
- }
-
- private void visitV2Node(JsonNode node) {
String path = node.key().getTokenValue();
if (matchLevel(path)) addIssue(key, translate(MESSAGE), node.key());
}
private boolean matchLevel(String path) {
- String levelRegex = "\\/[^/{}]*\\/\\{[^/{}]*\\}";
- Pattern levelPattern = Pattern.compile(levelRegex);
- Matcher levelMatcher = levelPattern.matcher(path);
- Integer levels = 0;
- while ( levelMatcher.find() ) {
- levels++;
- }
-
- long pathParts = Stream.of(path.split("/")).filter(p -> !p.trim().isEmpty()).count();
- return matchLevel(pathParts - levels);
-
+ long literalCount = Stream.of(path.split("/"))
+ .filter(s -> !s.trim().isEmpty())
+ .filter(s -> !(s.startsWith("{") && s.endsWith("}")))
+ .filter(s -> !s.equals("me"))
+ .count();
+ return matchLevel(literalCount);
}
abstract boolean matchLevel(long level);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourcesByVerbCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourcesByVerbCheck.java
index 8f421eb5..09e5eef7 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourcesByVerbCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractResourcesByVerbCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -47,7 +48,7 @@ private void init() {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -67,7 +68,8 @@ private JsonNode findParentPathNode(JsonNode node) {
JsonNode parent = (JsonNode) node.getParent();
while (parent != null && !(parent.getType() == OpenApi2Grammar.PATH
|| parent.getType() == OpenApi3Grammar.PATH
- || parent.getType() == OpenApi31Grammar.PATH)) {
+ || parent.getType() == OpenApi31Grammar.PATH
+ || parent.getType() == OpenApi32Grammar.PATH)) {
parent = (JsonNode) parent.getParent();
}
return parent;
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractVerbPathCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractVerbPathCheck.java
index bd2a6bb5..6532921c 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractVerbPathCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/AbstractVerbPathCheck.java
@@ -5,6 +5,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.schemas.AbstractSchemaCheck;
import apiaddicts.sonar.openapi.utils.JsonNodeUtils;
@@ -26,7 +27,7 @@ protected AbstractVerbPathCheck(String key) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheck.java
index c75e15ff..7b16f390 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheck.java
@@ -6,6 +6,8 @@
import org.sonar.check.RuleProperty;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -39,7 +41,7 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheck.java
index 5e583606..ccf4eb3e 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -19,7 +20,7 @@ public class OAR013DefaultResponseCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.RESPONSES, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES);
+ return ImmutableSet.of(OpenApi2Grammar.RESPONSES, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES, OpenApi32Grammar.RESPONSES);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheck.java
index d8c53479..75164014 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheck.java
@@ -32,6 +32,6 @@ public OAR014ResourceLevelWithinNonSuggestedRangeCheck() {
@Override
boolean matchLevel(long level) {
- return minLevel <= level && maxLevel >= level;
+ return minLevel <= level;
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheck.java
index 83db0b98..41796f8e 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheck.java
@@ -4,11 +4,13 @@
import com.google.common.collect.ImmutableSet;
import com.sonar.sslr.api.AstNodeType;
import java.util.Arrays;
+import java.util.List;
import java.util.Set;
import java.util.stream.Stream;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -18,7 +20,6 @@ public class OAR017ResourcePathCheck extends BaseCheck {
public static final String KEY = "OAR017";
private static final String MESSAGE = "OAR017.error";
- private static final String MESSAGE_PATTERN = "OAR017.error-patterns";
public static final String EXCLUDE_PATTERNS = "get,me,search";
@RuleProperty(
@@ -29,50 +30,51 @@ public class OAR017ResourcePathCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
- visitV2Node(node);
- }
-
- private void visitV2Node(JsonNode node) {
String path = node.key().getTokenValue();
- if (!isCorrect(path,node)) addIssue(KEY, translate(MESSAGE), node.key());
+ if (!isCorrect(path)) addIssue(KEY, translate(MESSAGE), node.key());
}
- private boolean isCorrect(String path, JsonNode node) {
+ private boolean isCorrect(String path) {
String[] parts = Stream.of(path.split("/")).filter(p -> !p.trim().isEmpty()).toArray(String[]::new);
- String[] patterns = Stream.of(patternsString.split(",")).toArray(String[]::new);
+ List except = Arrays.asList(patternsString.split(","));
+
if (parts.length == 0) return true;
- boolean previousWasVariable = false;
- boolean twoOrMoreVariablesInARow = false;
+ boolean previousIsVar;
+ String firstPart = parts[0];
+
+ if (except.contains(firstPart.trim())) {
+ previousIsVar = true;
+ } else if (isVariable(firstPart)) {
+ return false;
+ } else {
+ previousIsVar = false;
+ }
- for (int i = 0; i < parts.length; i++) {
- boolean currentIsVariable = isVariable(parts[i]);
+ for (int i = 1; i < parts.length; i++) {
+ String part = parts[i].trim();
- if(!currentIsVariable && Arrays.asList(patterns).contains(parts[i])){
- issuePatterns(parts[i],node);
+ if (except.contains(part)) {
+ previousIsVar = true;
+ continue;
}
- if (previousWasVariable && currentIsVariable) {
- twoOrMoreVariablesInARow = true;
- break;
+ boolean currentIsVariable = isVariable(part);
+ if (currentIsVariable == previousIsVar) {
+ return false;
}
-
- previousWasVariable = currentIsVariable;
+ previousIsVar = currentIsVariable;
}
- return !twoOrMoreVariablesInARow;
+ return true;
}
private boolean isVariable(String part) {
- return '{' == part.charAt(0) && '}' == part.charAt(part.length() - 1);
- }
-
- private void issuePatterns(String pattern,JsonNode node){
- addIssue(KEY, translate(MESSAGE_PATTERN,pattern), node.key());
+ return part.length() >= 2 && part.charAt(0) == '{' && part.charAt(part.length() - 1) == '}';
}
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheck.java
index 7181057c..88c8d9dd 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -19,7 +20,7 @@ public class OAR027PostResponseLocationHeaderCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheck.java
index 932c06eb..964dd45d 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -35,7 +36,7 @@ public class OAR030StatusEndpointCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheck.java
index a0ddd3d9..0a2af0d5 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -41,7 +42,7 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheck.java
index 31f5f7fa..6cfaa928 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheck.java
@@ -17,12 +17,14 @@ public class OAR038StandardCreateResponseCheck extends AbstractExplicitResponseC
public static final String KEY = "OAR038";
private static final String DATA_PROPERTY = "data";
+ private static final String ERROR_PROPERTY = "error";
@RuleProperty(
key = "data-property",
- description = "Data property in standard response.",
+ description = "Valid top-level property name for the standard response.",
defaultValue = DATA_PROPERTY
)
+ @SuppressWarnings("unused")
private String dataNode = DATA_PROPERTY;
public OAR038StandardCreateResponseCheck() {
@@ -34,20 +36,26 @@ protected void visitV2ExplicitNode(JsonNode node) {
JsonNode schemaNode = node.get("schema");
if (schemaNode.isMissing()) {
addIssue(KEY, translate("OAR038.error-required-schema"), node.key());
- } else {
- schemaNode = resolve(schemaNode);
-
- Map properties = getAllProperties(schemaNode);
+ return;
+ }
- validateProperty(properties, dataNode, TYPE_ANY, schemaNode.key())
- .ifPresent(this::validateData);
+ schemaNode = resolve(schemaNode);
+ Map properties = getAllProperties(schemaNode);
+
+ for (Map.Entry entry : properties.entrySet()) {
+ String propName = entry.getKey();
+ if (DATA_PROPERTY.equals(propName) || ERROR_PROPERTY.equals(propName)) {
+ Map subProps = getAllProperties(resolve(entry.getValue()));
+ if (subProps.isEmpty()) {
+ addIssue(KEY, translate("OAR038.error-required-one-property"), entry.getValue().key());
+ }
+ } else {
+ addIssue(KEY, translate("OAR038.error"), entry.getValue().key());
+ }
}
- }
- private void validateData(JsonNode data) {
- Map properties = getAllProperties(data);
if (properties.isEmpty()) {
- addIssue(KEY, translate("OAR038.error-required-one-property"), data.key());
+ addIssue(KEY, translate("OAR038.error"), schemaNode.key());
}
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheck.java
index e0e947d0..5c862ad7 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheck.java
@@ -25,6 +25,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -36,7 +37,7 @@ public class OAR046DeclaredTagCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheck.java
index 618a327e..afd3f604 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheck.java
@@ -26,6 +26,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.impl.MissingNode;
@@ -41,7 +42,7 @@ public class OAR047DocumentedTagCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.TAG, OpenApi2Grammar.OPERATION, OpenApi3Grammar.TAG, OpenApi31Grammar.TAG, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return Sets.newHashSet(OpenApi2Grammar.TAG, OpenApi2Grammar.OPERATION, OpenApi3Grammar.TAG, OpenApi31Grammar.TAG, OpenApi32Grammar.TAG, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -63,7 +64,7 @@ public void visitFile(JsonNode root) {
@Override
protected void visitNode(JsonNode node) {
AstNodeType nodeType = node.getType();
- if (nodeType == OpenApi2Grammar.TAG || nodeType == OpenApi3Grammar.TAG) {
+ if (nodeType == OpenApi2Grammar.TAG || nodeType == OpenApi3Grammar.TAG || nodeType == OpenApi31Grammar.TAG || nodeType == OpenApi32Grammar.TAG) {
visitTag(node);
} else {
visitOperation(node);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheck.java
index 6ccb1cc1..9105e4f5 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -68,19 +69,19 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
public void visitNode(JsonNode node) {
AstNodeType type = node.getType();
- if (isType(type, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH)) {
+ if (isType(type, OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH)) {
currentPath = node.key().getTokenValue();
return;
}
- if (isType(type, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION)) {
+ if (isType(type, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION)) {
if (shouldExcludePath() || !"get".equalsIgnoreCase(node.key().getTokenValue())) {
return;
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheck.java
index 90a5a1f3..b0f570ce 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -20,12 +21,12 @@ public class OAR091ParamOnlyRefCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitParametersNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheck.java
index 53cd2a59..1df9f83f 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheck.java
@@ -5,6 +5,7 @@
import org.sonar.check.Rule;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -19,12 +20,12 @@ public class OAR092RequestBodyOnlyRefCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi3Grammar.PATHS);
+ return ImmutableSet.of(OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheck.java
index 29ba8f3c..a277dcc7 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -20,12 +21,12 @@ public class OAR093ResponseOnlyRefCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitResponseNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheck.java
index 82f04b2c..c11cdfd2 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheck.java
@@ -12,6 +12,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
@Rule(key = OAR109ForbiddenInternalServerErrorCheck.KEY)
public class OAR109ForbiddenInternalServerErrorCheck extends BaseCheck {
@@ -21,7 +22,7 @@ public class OAR109ForbiddenInternalServerErrorCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheck.java
index ace904c9..e0d16801 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheck.java
@@ -10,7 +10,7 @@ public class OAR073RateLimitCheck extends AbstractPathResponseCheck {
private static final String MESSAGE = "OAR073.error";
private static final String DEFAULT_PATH_STATUS = "/status";
- private static final String DEFAULT_PATHS = DEFAULT_PATH_STATUS + ", /health-check";
+ private static final String DEFAULT_PATHS = DEFAULT_PATH_STATUS + ", /health, /health-check, /ping, /liveness, /readiness";
private static final String DEFAULT_STRATEGY = "/exclude";
public OAR073RateLimitCheck() {
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractCollectionQueryParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractCollectionQueryParameterCheck.java
new file mode 100644
index 00000000..0eef8f02
--- /dev/null
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractCollectionQueryParameterCheck.java
@@ -0,0 +1,30 @@
+package apiaddicts.sonar.openapi.checks.parameters;
+
+import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
+
+public abstract class AbstractCollectionQueryParameterCheck extends AbstractQueryParameterCheck {
+
+ protected AbstractCollectionQueryParameterCheck(
+ String ruleKey,
+ String messageKey,
+ String parameterName,
+ boolean applyToParameterizedPaths
+ ) {
+ super(ruleKey, messageKey, parameterName, applyToParameterizedPaths);
+ }
+
+ @Override
+ public void visitNode(JsonNode node) {
+ if (!"get".equals(node.key().getTokenValue())) return;
+
+ String path = getPath(node);
+
+ if (endsWithPathParam(path)) return;
+ if (path.contains("/me/") || path.endsWith("/me")) return;
+ if (path.contains("status") || path.contains("health") || path.contains("ping")) return;
+
+ if (!hasParameterInNode(node)) {
+ addIssue(ruleKey, translate(messageKey, parameterName), node.key());
+ }
+ }
+}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractParameterCheck.java
index c4676a78..355c7fa8 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractParameterCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractParameterCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -17,7 +18,8 @@ public Set subscribedKinds() {
return ImmutableSet.of(
OpenApi2Grammar.PARAMETER,
OpenApi3Grammar.PARAMETER,
- OpenApi31Grammar.PARAMETER
+ OpenApi31Grammar.PARAMETER,
+ OpenApi32Grammar.PARAMETER
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractQueryParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractQueryParameterCheck.java
index 06d6889e..c5f31e28 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractQueryParameterCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/AbstractQueryParameterCheck.java
@@ -11,6 +11,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.RuleProperty;
@@ -24,7 +25,7 @@ public abstract class AbstractQueryParameterCheck extends BaseCheck {
protected final String ruleKey;
protected final String messageKey;
- protected final String parameterName;
+ protected String parameterName;
protected final boolean applyToParameterizedPaths;
protected Set paths;
@@ -58,7 +59,7 @@ protected AbstractQueryParameterCheck(
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -113,10 +114,10 @@ protected boolean isRefParameter(JsonNode parameterNode) {
protected boolean hasNamedRefParameter(JsonNode parameterNode) {
String refValue = parameterNode.get("$ref").getTokenValue();
- JsonNode refParameterNode = resolveReference(refValue, rootNode);
+ JsonNode refParameterNode = resolveReference(refValue, rootNode);
if (refParameterNode != null) {
JsonNode nameNode = refParameterNode.get("name");
- JsonNode inNode = refParameterNode.get("in");
+ JsonNode inNode = refParameterNode.get("in");
return inNode != null && "query".equals(inNode.getTokenValue()) && nameNode != null && parameterName.equals(nameNode.getTokenValue());
}
return false;
@@ -130,9 +131,9 @@ protected boolean hasDirectParameter(JsonNode parameterNode) {
protected String getPath(JsonNode node) {
StringBuilder pathBuilder = new StringBuilder();
- AstNode pathNode = node.getFirstAncestor(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ AstNode pathNode = node.getFirstAncestor(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
if (pathNode != null) {
- while (pathNode.getType() != OpenApi2Grammar.PATH && pathNode.getType() != OpenApi3Grammar.PATH && pathNode.getType() != OpenApi31Grammar.PATH) {
+ while (pathNode.getType() != OpenApi2Grammar.PATH && pathNode.getType() != OpenApi3Grammar.PATH && pathNode.getType() != OpenApi31Grammar.PATH && pathNode.getType() != OpenApi32Grammar.PATH) {
pathNode = pathNode.getParent();
}
pathBuilder.append(((JsonNode) pathNode).key().getTokenValue());
@@ -141,6 +142,9 @@ protected String getPath(JsonNode node) {
}
protected boolean shouldIncludePath(String path) {
+ if (paths.isEmpty()) {
+ return pathCheckStrategy.equals(PATH_STRATEGY_EXCLUDE);
+ }
if (pathCheckStrategy.equals(PATH_STRATEGY_EXCLUDE)) {
return !paths.contains(path);
} else if (pathCheckStrategy.equals(PATH_STRATEGY_INCLUDE)) {
@@ -168,8 +172,8 @@ protected Set parsePaths(String pathsStr) {
}
protected JsonNode resolveReference(String refValue, JsonNode root) {
- if (refValue == null || !refValue.startsWith("#/")) {
- return null;
+ if (refValue == null || !refValue.startsWith("#/")) {
+ return null;
}
String pathToReference = refValue.substring(2);
@@ -178,7 +182,7 @@ protected JsonNode resolveReference(String refValue, JsonNode root) {
JsonNode currentNode = root;
for (String part : pathParts) {
if (currentNode == null) {
- return null;
+ return null;
}
currentNode = currentNode.get(part);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheck.java
index 355ff4d4..fdac58e8 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheck.java
@@ -3,19 +3,13 @@
import org.sonar.check.Rule;
@Rule(key = OAR020ExpandParameterCheck.KEY)
-public class OAR020ExpandParameterCheck extends AbstractQueryParameterCheck {
+public class OAR020ExpandParameterCheck extends AbstractCollectionQueryParameterCheck {
public static final String KEY = "OAR020";
private static final String MESSAGE = "OAR020.error";
private static final String PARAM_NAME = "$expand";
public OAR020ExpandParameterCheck() {
- super(
- KEY,
- MESSAGE,
- PARAM_NAME,
- false
- );
+ super(KEY, MESSAGE, PARAM_NAME, false);
}
-
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheck.java
index 65d031db..a8b52bfc 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheck.java
@@ -3,18 +3,13 @@
import org.sonar.check.Rule;
@Rule(key = OAR021ExcludeParameterCheck.KEY)
-public class OAR021ExcludeParameterCheck extends AbstractQueryParameterCheck {
+public class OAR021ExcludeParameterCheck extends AbstractCollectionQueryParameterCheck {
public static final String KEY = "OAR021";
private static final String MESSAGE = "OAR021.error";
private static final String PARAM_NAME = "$exclude";
public OAR021ExcludeParameterCheck() {
- super(
- KEY,
- MESSAGE,
- PARAM_NAME,
- false
- );
+ super(KEY, MESSAGE, PARAM_NAME, false);
}
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheck.java
index 5052ead5..57f41e5e 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -19,7 +20,7 @@ public class OAR026TotalParameterDefaultValueCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER);
+ return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi32Grammar.PARAMETER);
}
@Override
@@ -29,7 +30,7 @@ public void visitNode(JsonNode node) {
private void visitV2Node(JsonNode node) {
if (!"$total".equals(node.get("name").getTokenValue())) return;
- JsonNode defaultNode = ( node.getType() == OpenApi2Grammar.PARAMETER ) ? node.get("default") : node.at("/schema/default");
+ JsonNode defaultNode = (node.getType() == OpenApi2Grammar.PARAMETER) ? node.get("default") : node.at("/schema/default");
if (defaultNode.isMissing()) {
if (node.key().isMissing()) {
addIssue(KEY, translate(MESSAGE), node);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheck.java
index 93f271f8..703e56e9 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheck.java
@@ -1,114 +1,30 @@
package apiaddicts.sonar.openapi.checks.parameters;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
-import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
-import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
-import apiaddicts.sonar.openapi.checks.BaseCheck;
-
-import com.google.common.collect.ImmutableSet;
-import com.sonar.sslr.api.AstNode;
-import com.sonar.sslr.api.AstNodeType;
-
-import java.util.Arrays;
-import java.util.HashSet;
@Rule(key = OAR028FilterParameterCheck.KEY)
-public class OAR028FilterParameterCheck extends BaseCheck {
+public class OAR028FilterParameterCheck extends AbstractCollectionQueryParameterCheck {
public static final String KEY = "OAR028";
private static final String MESSAGE = "OAR028.error";
- private static final String DEFAULT_PATH = "/examples";
- private static final String PATH_STRATEGY = "/include";
- private static final String PARAM_NAME = "$filter";
-
- private static final String PATH_STRATEGY_EXCLUDE = "/exclude";
- private static final String PATH_STRATEGY_INCLUDE = "/include";
-
- @RuleProperty(
- key = "paths",
- description = "List of explicit paths to include/exclude from this rule separated by comma",
- defaultValue = DEFAULT_PATH
- )
- private String pathsStr = DEFAULT_PATH;
-
- @RuleProperty(
- key = "pathValidationStrategy",
- description = "Path validation strategy (include/exclude)",
- defaultValue = PATH_STRATEGY
- )
- private String pathCheckStrategy = PATH_STRATEGY;
+ private static final String DEFAULT_PARAM_NAME = "$filter";
@RuleProperty(
key = "parameterName",
- description = "Name of the parameter to be checked",
- defaultValue = PARAM_NAME
+ description = "Name of the query parameter to be checked",
+ defaultValue = DEFAULT_PARAM_NAME
)
- private String parameterName = PARAM_NAME;
-
- private Set paths;
+ private String filterParamName = DEFAULT_PARAM_NAME;
- @Override
- public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER);
+ public OAR028FilterParameterCheck() {
+ super(KEY, MESSAGE, DEFAULT_PARAM_NAME, false);
}
@Override
protected void visitFile(JsonNode root) {
- paths = parsePaths(pathsStr);
+ this.parameterName = filterParamName;
super.visitFile(root);
}
-
- @Override
- public void visitNode(JsonNode node) {
- visitParameterNode(node);
- }
-
- public void visitParameterNode(JsonNode node) {
- JsonNode inNode = node.get("in");
- JsonNode nameNode = node.get("name");
-
- if (inNode != null && nameNode != null) {
- String path = getPath(node);
- if (shouldExcludePath(path) && !parameterName.equals(nameNode.getTokenValue())) {
- addIssue(KEY, translate(MESSAGE, parameterName), nameNode);
- }
- }
- }
-
- private String getPath(JsonNode node) {
- StringBuilder pathBuilder = new StringBuilder();
- AstNode pathNode = node.getFirstAncestor(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
- if (pathNode != null) {
- while (pathNode.getType() != OpenApi2Grammar.PATH && pathNode.getType() != OpenApi3Grammar.PATH && pathNode.getType() != OpenApi31Grammar.PATH) {
- pathNode = pathNode.getParent();
- }
- pathBuilder.append(((JsonNode) pathNode).key().getTokenValue());
- }
- return pathBuilder.toString();
- }
-
- private boolean shouldExcludePath(String path) {
- if (pathCheckStrategy.equals(PATH_STRATEGY_EXCLUDE)) {
- return !paths.contains(path);
- } else if (pathCheckStrategy.equals(PATH_STRATEGY_INCLUDE)) {
- return paths.contains(path);
- }
- return false;
- }
-
- private Set parsePaths(String pathsStr) {
- if (!pathsStr.trim().isEmpty()) {
- return Arrays.stream(pathsStr.split(","))
- .map(String::trim)
- .collect(Collectors.toSet());
- } else {
- return new HashSet<>();
- }
- }
-}
\ No newline at end of file
+}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheck.java
index 212e38af..7f8f269a 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheck.java
@@ -4,6 +4,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.sonar.check.Rule;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import com.google.common.collect.ImmutableSet;
@@ -21,18 +22,18 @@ public class OAR069PathParamAndQueryCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
public void visitNode(JsonNode node) {
- if (node.getType() == OpenApi2Grammar.OPERATION || node.getType() == OpenApi3Grammar.OPERATION || node.getType() == OpenApi31Grammar.OPERATION) {
+ if (node.getType() == OpenApi2Grammar.OPERATION || node.getType() == OpenApi3Grammar.OPERATION || node.getType() == OpenApi31Grammar.OPERATION || node.getType() == OpenApi32Grammar.OPERATION) {
visitOperationNode(node);
}
}
private void visitOperationNode(JsonNode node) {
- List parameters = node.getDescendants(OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER)
+ List parameters = node.getDescendants(OpenApi2Grammar.PARAMETER, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi32Grammar.PARAMETER)
.stream()
.map(JsonNode.class::cast)
.collect(Collectors.toList());
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheck.java
index 5a775b02..d113b2cf 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheck.java
@@ -8,6 +8,8 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.impl.MissingNode;
@@ -70,6 +72,32 @@ public Set subscribedKinds() {
OpenApi3Grammar.TAG,
OpenApi3Grammar.SERVER,
OpenApi3Grammar.EXTERNAL_DOC,
+ OpenApi31Grammar.ROOT,
+ OpenApi31Grammar.PATHS,
+ OpenApi31Grammar.OPERATION,
+ OpenApi31Grammar.INFO,
+ OpenApi31Grammar.RESPONSES,
+ OpenApi31Grammar.PARAMETER,
+ OpenApi31Grammar.COMPONENTS,
+ OpenApi31Grammar.REQUEST_BODY,
+ OpenApi31Grammar.SCHEMA,
+ OpenApi31Grammar.SECURITY_SCHEME,
+ OpenApi31Grammar.TAG,
+ OpenApi31Grammar.SERVER,
+ OpenApi31Grammar.EXTERNAL_DOC,
+ OpenApi32Grammar.ROOT,
+ OpenApi32Grammar.PATHS,
+ OpenApi32Grammar.OPERATION,
+ OpenApi32Grammar.INFO,
+ OpenApi32Grammar.RESPONSES,
+ OpenApi32Grammar.PARAMETER,
+ OpenApi32Grammar.COMPONENTS,
+ OpenApi32Grammar.REQUEST_BODY,
+ OpenApi32Grammar.SCHEMA,
+ OpenApi32Grammar.SECURITY_SCHEME,
+ OpenApi32Grammar.TAG,
+ OpenApi32Grammar.SERVER,
+ OpenApi32Grammar.EXTERNAL_DOC,
OpenApi2Grammar.ROOT,
OpenApi2Grammar.PATHS,
OpenApi2Grammar.OPERATION,
@@ -81,7 +109,6 @@ public Set subscribedKinds() {
OpenApi2Grammar.SECURITY_SCHEME,
OpenApi2Grammar.TAG,
OpenApi2Grammar.EXTERNAL_DOC
-
);
}
@@ -95,18 +122,18 @@ public void visitNode(JsonNode node) {
boolean isMethod = isPathRoot && Arrays.asList("get", "post", "put", "patch", "delete")
.contains(nodeSegments[1].toLowerCase());
- if (pathSegments.contains("info") && isType(type, OpenApi3Grammar.ROOT, OpenApi2Grammar.ROOT)) {
+ if (pathSegments.contains("info") && isType(type, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT, OpenApi2Grammar.ROOT)) {
handleInfoSection(node, pathSegments);
- } else if (pathSegments.contains("servers") && type.equals(OpenApi3Grammar.SERVER)) {
+ } else if (pathSegments.contains("servers") && isType(type, OpenApi3Grammar.SERVER, OpenApi31Grammar.SERVER, OpenApi32Grammar.SERVER)) {
handleServerNode(node, pathSegments);
- } else if (isMethod && isType(type, OpenApi3Grammar.OPERATION, OpenApi2Grammar.OPERATION)) {
+ } else if (isMethod && isType(type, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION, OpenApi2Grammar.OPERATION)) {
handleOperationsNode(node, pathSegments);
- } else if (pathSegments.contains("tags") && isType(type, OpenApi3Grammar.TAG, OpenApi2Grammar.TAG)) {
+ } else if (pathSegments.contains("tags") && isType(type, OpenApi3Grammar.TAG, OpenApi31Grammar.TAG, OpenApi32Grammar.TAG, OpenApi2Grammar.TAG)) {
handleTagsNode(node, pathSegments);
- } else if (pathSegments.contains("externalDocs") && isType(type, OpenApi3Grammar.EXTERNAL_DOC, OpenApi2Grammar.EXTERNAL_DOC)) {
+ } else if (pathSegments.contains("externalDocs") && isType(type, OpenApi3Grammar.EXTERNAL_DOC, OpenApi31Grammar.EXTERNAL_DOC, OpenApi32Grammar.EXTERNAL_DOC, OpenApi2Grammar.EXTERNAL_DOC)) {
handleExternalDocsNode(node, pathSegments);
} else if (isMethod && nodeSegments.length > 2 && "parameters".equals(nodeSegments[2])
- && isType(type, OpenApi3Grammar.PARAMETER, OpenApi2Grammar.PARAMETERS)) {
+ && isType(type, OpenApi3Grammar.PARAMETER, OpenApi31Grammar.PARAMETER, OpenApi32Grammar.PARAMETER, OpenApi2Grammar.PARAMETERS)) {
handleParametersNode(node, pathSegments);
}
}
@@ -182,4 +209,4 @@ private void validateNodeWithRegex(JsonNode parentNode, String childKey, String
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/AbstractExplicitResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/AbstractExplicitResponseCheck.java
index d7dc092b..106dca05 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/AbstractExplicitResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/AbstractExplicitResponseCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -25,7 +26,7 @@ protected AbstractExplicitResponseCheck(String key, String responseCode) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.RESPONSES, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES);
+ return ImmutableSet.of(OpenApi2Grammar.RESPONSES, OpenApi3Grammar.RESPONSES, OpenApi31Grammar.RESPONSES, OpenApi32Grammar.RESPONSES);
}
@Override
@@ -46,7 +47,7 @@ protected void visitResponsesNode(JsonNode node) {
visitV2ExplicitNode(resolved);
}
- else if (OpenApi3Grammar.RESPONSE.equals(type) || OpenApi31Grammar.RESPONSE.equals(type)) {
+ else if (OpenApi3Grammar.RESPONSE.equals(type) || OpenApi31Grammar.RESPONSE.equals(type) || OpenApi32Grammar.RESPONSE.equals(type)) {
handleV3Response(resolved);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheck.java
index c78ee24f..e61aee17 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheck.java
@@ -11,6 +11,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Arrays;
@@ -77,7 +78,7 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
@@ -99,7 +100,7 @@ private void visitPathNode(JsonNode node) {
handleExternalRef.resolve(propResponse.value(), resolved -> {
if (resolved.getType().equals(OpenApi2Grammar.RESPONSE)) {
visitSchemaNode(resolved, statusCode);
- } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE)) {
+ } else if (resolved.getType().equals(OpenApi3Grammar.RESPONSE) || resolved.getType().equals(OpenApi31Grammar.RESPONSE) || resolved.getType().equals(OpenApi32Grammar.RESPONSE)) {
resolved.at("/content").propertyMap().forEach((mediaType, mediaTypeNode) -> {
if (mediaType.toLowerCase().contains("json")) {
visitSchemaNode(mediaTypeNode, statusCode);
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheck.java
index 6b22172d..147c805b 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheck.java
@@ -9,6 +9,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -40,9 +41,11 @@ public Set subscribedKinds() {
OpenApi2Grammar.PATH,
OpenApi3Grammar.PATH,
OpenApi31Grammar.PATH,
+ OpenApi32Grammar.PATH,
OpenApi2Grammar.OPERATION,
OpenApi3Grammar.OPERATION,
- OpenApi31Grammar.OPERATION
+ OpenApi31Grammar.OPERATION,
+ OpenApi32Grammar.OPERATION
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheck.java
index 9b599379..8153a58c 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheck.java
@@ -7,6 +7,8 @@
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import java.util.HashMap;
import java.util.Map;
@@ -20,7 +22,7 @@ public class OAR108SchemaValidatorCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi3Grammar.PATHS, OpenApi31Grammar.PATHS, OpenApi32Grammar.PATHS);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractPathAwareOperationCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractPathAwareOperationCheck.java
index 64f34a30..d27877f6 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractPathAwareOperationCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractPathAwareOperationCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -20,9 +21,11 @@ public Set subscribedKinds() {
OpenApi2Grammar.PATH,
OpenApi3Grammar.PATH,
OpenApi31Grammar.PATH,
+ OpenApi32Grammar.PATH,
OpenApi2Grammar.OPERATION,
OpenApi3Grammar.OPERATION,
- OpenApi31Grammar.OPERATION
+ OpenApi31Grammar.OPERATION,
+ OpenApi32Grammar.OPERATION
);
}
@@ -32,7 +35,8 @@ public void visitNode(JsonNode node) {
if (type == OpenApi2Grammar.PATH
|| type == OpenApi3Grammar.PATH
- || type == OpenApi31Grammar.PATH) {
+ || type == OpenApi31Grammar.PATH
+ || type == OpenApi32Grammar.PATH) {
currentPath = node.key().getTokenValue();
return;
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractSecurityResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractSecurityResponseCheck.java
index 7a7de47e..af301d44 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractSecurityResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractSecurityResponseCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Arrays;
@@ -38,7 +39,7 @@ protected AbstractSecurityResponseCheck(String ruleKey, String messageKey, Strin
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractTypedParameterIntegrityCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractTypedParameterIntegrityCheck.java
index c3dfde43..03488ae8 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractTypedParameterIntegrityCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/AbstractTypedParameterIntegrityCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -24,7 +25,8 @@ public Set subscribedKinds() {
return ImmutableSet.of(
OpenApi2Grammar.PARAMETER,
OpenApi3Grammar.PARAMETER,
- OpenApi31Grammar.PARAMETER
+ OpenApi31Grammar.PARAMETER,
+ OpenApi32Grammar.PARAMETER
);
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheck.java
index 2cef1c2a..64e400be 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -20,7 +21,7 @@ public class OAR001MandatoryHttpsProtocolCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheck.java
index 0439b45a..ccb199bc 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import apiaddicts.sonar.openapi.utils.JsonNodeUtils;
@@ -75,14 +76,14 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
public void visitNode(JsonNode node) {
if (node.getType() == OpenApi2Grammar.PATH) {
visitPathV2Node(node);
- } else if (node.getType() == OpenApi3Grammar.PATH || node.getType() == OpenApi31Grammar.PATH){
+ } else if (node.getType() == OpenApi3Grammar.PATH || node.getType() == OpenApi31Grammar.PATH || node.getType() == OpenApi32Grammar.PATH){
visitPathV3Node(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismsCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismsCheck.java
index d158e3ff..c4c880ea 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismsCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismsCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -19,16 +20,16 @@ public class OAR036SessionMechanismsCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi2Grammar.HEADER, OpenApi3Grammar.PARAMETER, OpenApi3Grammar.HEADER, OpenApi31Grammar.PARAMETER, OpenApi31Grammar.HEADER);
+ return ImmutableSet.of(OpenApi2Grammar.PARAMETER, OpenApi2Grammar.HEADER, OpenApi3Grammar.PARAMETER, OpenApi3Grammar.HEADER, OpenApi31Grammar.PARAMETER, OpenApi31Grammar.HEADER, OpenApi32Grammar.PARAMETER, OpenApi32Grammar.HEADER);
}
@Override
public void visitNode(JsonNode node) {
- if ( ( OpenApi2Grammar.PARAMETER.equals(node.getType()) || OpenApi3Grammar.PARAMETER.equals(node.getType()) || OpenApi31Grammar.PARAMETER.equals(node.getType()))
+ if ( ( OpenApi2Grammar.PARAMETER.equals(node.getType()) || OpenApi3Grammar.PARAMETER.equals(node.getType()) || OpenApi31Grammar.PARAMETER.equals(node.getType()) || OpenApi32Grammar.PARAMETER.equals(node.getType()))
&& "header".equals(node.get("in").getTokenValue()) && "Cookie".equals(node.get("name").getTokenValue())) {
addIssue(KEY, translate(MESSAGE), node.get("name").value());
}
- if ( ( OpenApi2Grammar.HEADER.equals(node.getType()) || OpenApi3Grammar.HEADER.equals(node.getType()) || OpenApi31Grammar.HEADER.equals(node.getType()) )
+ if ( ( OpenApi2Grammar.HEADER.equals(node.getType()) || OpenApi3Grammar.HEADER.equals(node.getType()) || OpenApi31Grammar.HEADER.equals(node.getType()) || OpenApi32Grammar.HEADER.equals(node.getType()) )
&& "Set-Cookie".equals(node.key().getTokenValue())) {
addIssue(KEY, translate(MESSAGE), node.key());
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204Check.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204Check.java
index 9fe1d4df..0cf74277 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204Check.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204Check.java
@@ -25,6 +25,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -37,7 +38,7 @@ public class OAR049NoContentIn204Check extends BaseCheck {
@Override
public Set subscribedKinds() {
- return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return Sets.newHashSet(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -60,6 +61,6 @@ private void checkNoContent(JsonNode response) {
private static boolean hasContent(JsonNode effective) {
return effective.getType() instanceof OpenApi2Grammar && !effective.get("schema").isMissing()
- || effective.getType() instanceof OpenApi3Grammar && ! effective.get("content").isMissing() || effective.getType() instanceof OpenApi31Grammar && ! effective.get("content").isMissing();
+ || effective.getType() instanceof OpenApi3Grammar && ! effective.get("content").isMissing() || effective.getType() instanceof OpenApi31Grammar && ! effective.get("content").isMissing() || effective.getType() instanceof OpenApi32Grammar && ! effective.get("content").isMissing();
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheck.java
index b1b9229f..34ce2172 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheck.java
@@ -9,6 +9,8 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -72,7 +74,7 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheck.java
index c986b66b..035c0fe1 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -30,7 +31,7 @@ public class OAR054HostCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.SERVER, OpenApi31Grammar.SERVER);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.SERVER, OpenApi31Grammar.SERVER, OpenApi32Grammar.SERVER);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheck.java
index 1ce11226..5c77e50c 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -23,7 +24,7 @@ public class OAR072NonOKModelResponseCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -43,6 +44,8 @@ private void visitOperationNode(JsonNode node) {
checkOpenApiResponse(responseNode);
} else if (node.is(OpenApi31Grammar.OPERATION)) {
checkOpenApiResponse(responseNode);
+ } else if (node.is(OpenApi32Grammar.OPERATION)) {
+ checkOpenApiResponse(responseNode);
}
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheck.java
index 07f3c303..eb2b5528 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheck.java
@@ -5,6 +5,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import apiaddicts.sonar.openapi.checks.BaseCheck;
@@ -23,7 +24,7 @@ public class OAR078VerbsSecurityCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION);
+ return ImmutableSet.of(OpenApi2Grammar.PATH, OpenApi3Grammar.PATH, OpenApi31Grammar.PATH, OpenApi32Grammar.PATH, OpenApi2Grammar.OPERATION, OpenApi3Grammar.OPERATION, OpenApi31Grammar.OPERATION, OpenApi32Grammar.OPERATION);
}
@Override
@@ -41,8 +42,8 @@ public void visitNode(JsonNode node) {
Object type = node.getType();
- if (type == OpenApi2Grammar.PATH || type == OpenApi3Grammar.PATH || type == OpenApi31Grammar.PATH ||
- type == OpenApi2Grammar.OPERATION || type == OpenApi3Grammar.OPERATION || type == OpenApi31Grammar.OPERATION) {
+ if (type == OpenApi2Grammar.PATH || type == OpenApi3Grammar.PATH || type == OpenApi31Grammar.PATH || type == OpenApi32Grammar.PATH ||
+ type == OpenApi2Grammar.OPERATION || type == OpenApi3Grammar.OPERATION || type == OpenApi31Grammar.OPERATION || type == OpenApi32Grammar.OPERATION) {
visitOperationNode(node);
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheck.java
index 1a0be7c9..37d8d909 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheck.java
@@ -7,6 +7,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Set;
@@ -21,12 +22,12 @@ public class OAR081PasswordFormatCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi2Grammar.DEFINITIONS, OpenApi3Grammar.PATHS, OpenApi3Grammar.COMPONENTS, OpenApi31Grammar.PATHS, OpenApi31Grammar.COMPONENTS);
+ return ImmutableSet.of(OpenApi2Grammar.PATHS, OpenApi2Grammar.DEFINITIONS, OpenApi3Grammar.PATHS, OpenApi3Grammar.COMPONENTS, OpenApi31Grammar.PATHS, OpenApi31Grammar.COMPONENTS, OpenApi32Grammar.PATHS, OpenApi32Grammar.COMPONENTS);
}
@Override
public void visitNode(JsonNode node) {
- if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType())) {
+ if (OpenApi2Grammar.PATHS.equals(node.getType()) || OpenApi3Grammar.PATHS.equals(node.getType()) || OpenApi31Grammar.PATHS.equals(node.getType()) || OpenApi32Grammar.PATHS.equals(node.getType())) {
visitPathsNode(node);
} else if (OpenApi2Grammar.DEFINITIONS.equals(node.getType())) {
visitDefinitionsNode(node);
@@ -40,6 +41,11 @@ public void visitNode(JsonNode node) {
if (!schemasNode.isMissing()) {
visitDefinitionsNode(schemasNode);
}
+ } else if (OpenApi32Grammar.COMPONENTS.equals(node.getType())) {
+ JsonNode schemasNode = node.get("schemas");
+ if (!schemasNode.isMissing()) {
+ visitDefinitionsNode(schemasNode);
+ }
}
}
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheck.java
index dd585c23..0c831f4a 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheck.java
@@ -10,6 +10,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import java.util.Arrays;
@@ -34,7 +35,7 @@ public class OAR082BinaryOrByteFormatCheck extends BaseCheck {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.SCHEMA, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA);
+ return ImmutableSet.of(OpenApi2Grammar.SCHEMA, OpenApi2Grammar.PARAMETER, OpenApi3Grammar.SCHEMA, OpenApi31Grammar.SCHEMA, OpenApi32Grammar.SCHEMA);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheck.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheck.java
index c102417b..2cc3ba66 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheck.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheck.java
@@ -6,6 +6,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import apiaddicts.sonar.openapi.checks.BaseCheck;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -19,7 +20,7 @@ public class OAR085OpenAPIVersionCheck extends BaseCheck {
public static final String KEY = "OAR085";
private static final String MESSAGE = "OAR085.error";
- private static final String DEFAULT_VALID_VERSIONS = "2.0,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0";
+ private static final String DEFAULT_VALID_VERSIONS = "2.0,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.2.0";
@RuleProperty(
key = "valid-versions",
@@ -56,6 +57,6 @@ private String getVersion(JsonNode swagger, JsonNode openapi) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT);
+ return ImmutableSet.of(OpenApi2Grammar.ROOT, OpenApi3Grammar.ROOT, OpenApi31Grammar.ROOT, OpenApi32Grammar.ROOT);
}
}
\ No newline at end of file
diff --git a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecks.java b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecks.java
index ad4df8b0..52845a24 100644
--- a/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecks.java
+++ b/src/main/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecks.java
@@ -12,6 +12,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
import org.sonar.check.Rule;
import org.sonar.check.RuleProperty;
@@ -49,7 +50,7 @@ protected void visitFile(JsonNode root) {
@Override
public Set subscribedKinds() {
- return ImmutableSet.of(OpenApi2Grammar.RESPONSE, OpenApi3Grammar.RESPONSE, OpenApi31Grammar.RESPONSE);
+ return ImmutableSet.of(OpenApi2Grammar.RESPONSE, OpenApi3Grammar.RESPONSE, OpenApi31Grammar.RESPONSE, OpenApi32Grammar.RESPONSE);
}
@Override
diff --git a/src/main/java/apiaddicts/sonar/openapi/utils/JsonNodeUtils.java b/src/main/java/apiaddicts/sonar/openapi/utils/JsonNodeUtils.java
index 8dd2c5bc..1763698f 100644
--- a/src/main/java/apiaddicts/sonar/openapi/utils/JsonNodeUtils.java
+++ b/src/main/java/apiaddicts/sonar/openapi/utils/JsonNodeUtils.java
@@ -3,6 +3,7 @@
import org.apiaddicts.apitools.dosonarapi.api.v2.OpenApi2Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v3.OpenApi3Grammar;
import org.apiaddicts.apitools.dosonarapi.api.v31.OpenApi31Grammar;
+import org.apiaddicts.apitools.dosonarapi.api.v32.OpenApi32Grammar;
import org.apiaddicts.apitools.dosonarapi.openapi.OpenApiConfiguration;
import org.apiaddicts.apitools.dosonarapi.openapi.parser.OpenApiParser;
import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode;
@@ -17,14 +18,16 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.sonar.sslr.api.AstNodeType;
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
public class JsonNodeUtils {
- private static final Logger LOG = Logger.getLogger(JsonNodeUtils.class.getName());
+ private static final Logger LOG = Loggers.get(JsonNodeUtils.class);
+ private static final int CONNECT_TIMEOUT_MS = 5_000;
+ private static final int READ_TIMEOUT_MS = 10_000;
private JsonNodeUtils() {
// Intentional blank
@@ -48,7 +51,8 @@ public static JsonNode resolve(JsonNode original) {
if (ref.startsWith("#")) {
return original.resolve();
} else {
- return resolveExternalRef(ref);
+ JsonNode resolved = resolveExternalRef(ref);
+ return resolved != null ? resolved : original;
}
}
return original;
@@ -65,6 +69,9 @@ public static boolean isExternalRef (JsonNode original){
private static JsonNode resolveExternalRef(String url) {
String content = retriveExternalRefContent(url);
+ if (content == null) {
+ return null;
+ }
OpenApiConfiguration configuration = new OpenApiConfiguration(StandardCharsets.UTF_8, true);
YamlParser parser = OpenApiParser.createGeneric(configuration);
@@ -92,8 +99,10 @@ private static String retriveExternalRefContent(String ref) {
try {
URL url = URI.create(ref).toURL();
conn = (HttpURLConnection) url.openConnection();
+ conn.setConnectTimeout(CONNECT_TIMEOUT_MS);
+ conn.setReadTimeout(READ_TIMEOUT_MS);
conn.setRequestMethod("GET");
- conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36");
+ conn.setRequestProperty("User-Agent", "SonarQube OpenAPI Plugin");
conn.connect();
int responseCode = conn.getResponseCode();
@@ -105,11 +114,11 @@ private static String retriveExternalRefContent(String ref) {
}
} else {
handleErrorResponse(conn);
- return "Error: Response code " + responseCode;
+ return null;
}
} catch (IOException e) {
- LOG.log(Level.SEVERE, String.format("Error parsing external ref %s", ref), e);
- return "Error: " + e.getMessage();
+ LOG.warn("Cannot resolve external ref " + ref + ": " + e.getMessage());
+ return null;
} finally {
if (conn != null) {
conn.disconnect();
@@ -132,8 +141,7 @@ private static void handleErrorResponse(HttpURLConnection conn) throws IOExcepti
int responseCode = conn.getResponseCode();
InputStream errorStream = conn.getErrorStream();
String errorResponse = errorStream != null ? readInputStreamToString(errorStream) : "No error message";
- conn.getHeaderFields().forEach((key, value) -> LOG.info("Header " + key + ": " + value));
- LOG.log(Level.SEVERE, "Error resolving external ref {0} {1}", new Object[]{responseCode, errorResponse});
+ LOG.warn("External ref returned HTTP " + responseCode + ": " + errorResponse);
}
public static String getLastFetchedContent() {
@@ -182,6 +190,6 @@ public static boolean isType(JsonNode type, String name) {
public static boolean isOperation(JsonNode node) {
AstNodeType type = node.getType();
- return type.equals(OpenApi2Grammar.OPERATION) || type.equals(OpenApi3Grammar.OPERATION) || type.equals(OpenApi31Grammar.OPERATION);
+ return type.equals(OpenApi2Grammar.OPERATION) || type.equals(OpenApi3Grammar.OPERATION) || type.equals(OpenApi31Grammar.OPERATION) || type.equals(OpenApi32Grammar.OPERATION);
}
}
diff --git a/src/main/resources/messages/errors.properties b/src/main/resources/messages/errors.properties
index b1294d7d..3b47830f 100644
--- a/src/main/resources/messages/errors.properties
+++ b/src/main/resources/messages/errors.properties
@@ -38,6 +38,7 @@ OAR033.error-header-required=''{0}'' header must be required
OAR035.error=Response code {0} must be defined for operations with security schemes defined
OAR036.error=Cookie use is forbidden as a session mechanism
OAR037.error=String types requires a valid format
+OAR038.error=''data'' or ''error'' property is required
OAR038.error-required-schema=Response schema is required
OAR038.error-required-one-property=At least you have to define the identifier property
OAR039.error=Response code {0} must be defined
diff --git a/src/main/resources/messages/errors_es.properties b/src/main/resources/messages/errors_es.properties
index 29f1000a..738ba524 100644
--- a/src/main/resources/messages/errors_es.properties
+++ b/src/main/resources/messages/errors_es.properties
@@ -38,6 +38,7 @@ OAR033.error-header-required=La cabecera ''{0}'' debe ser obligatoria
OAR035.error=El código de respuesta {0} debe estar definido cuando la operación tiene esquemas de seguridad definidos
OAR036.error=El uso de cookies está prohibido como mecanismo de sesión
OAR037.error=Las propiedades de tipo string deben definir un formato válido
+OAR038.error=La propiedad ''data'' o ''error'' es obligatoria
OAR038.error-required-schema=El esquema de respuesta es obligatorio
OAR038.error-required-one-property=Se debe de definir al menos una propiedad
OAR039.error=Código de respuesta {0} debe ser definido
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR037.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR037.html
index 912b7292..7f3e14a0 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR037.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR037.html
@@ -1,4 +1,7 @@
-Una propiedad de tipo string con formato no válido puede provocar una implementación incorrecta de la API.
+Una propiedad de tipo string sin formato, o con un formato no reconocido, puede provocar una implementación incorrecta de la API.
+Esta regla dispara cuando el campo format está ausente o presente pero no es reconocido. Todo schema de tipo string debe declarar uno de los formatos válidos.
+Formatos válidos: date, date-time, password, byte, binary, email, uuid, uri, hostname, ipv4, ipv6, HEX, HEX(16), json, xml, base64.
+Configurable: formats-allowed — lista de formatos permitidos separados por coma (por defecto: la lista anterior).
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
@@ -16,8 +19,10 @@ Ejemplo de código no compatible (OpenAPI 2)
items:
type: object
properties:
+ name:
+ type: string # No conforme {{OAR037: Las propiedades de tipo string deben definir un formato válido}} — format ausente
date:
- type: string
+ type: string # No conforme {{OAR037: Las propiedades de tipo string deben definir un formato válido}} — format inválido
format: 'dd/mm/yyyy'
Solución compatible (OpenAPI 2)
@@ -60,8 +65,10 @@ Ejemplo de código no compatible (OpenAPI 3)
items:
type: object
properties:
+ name:
+ type: string # No conforme {{OAR037: Las propiedades de tipo string deben definir un formato válido}} — format ausente
date:
- type: string
+ type: string # No conforme {{OAR037: Las propiedades de tipo string deben definir un formato válido}} — format inválido
format: dd/mm/yyyy
Solución compatible (OpenAPI 3)
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR066.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR066.html
index 1121b63d..73f727e0 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR066.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/format/OAR066.html
@@ -1,4 +1,11 @@
Los nombres de las propiedades del esquema RequestBody y Responses deben cumplir la convención de nomenclatura snake_case
+Prefijos exentos
+Los siguientes prefijos de nombres de propiedades que siguen convenciones estándar de industria no están sujetos a esta regla:
+
+ - Prefijo
_ — campos estándar HAL/HATEOAS (_links, _embedded)
+ - Prefijo
@ — campos estándar JSON-LD W3C (@context, @type, @id)
+ - Prefijo
x- — convenciones de extensión OpenAPI (x-internal, x-campo-personalizado)
+
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR014.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR014.html
index 25257577..c59c7ebe 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR014.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR014.html
@@ -1,5 +1,6 @@
Una ruta compleja puede ser una insinuación para detectar definiciones de API incorrectas.
-El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta este entre 4 y 5 se mostrará una advertencia.
+El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta esté entre 4 y 5 se mostrará una advertencia.
+Nota: Los parámetros de ruta (p.ej. {customerId}) se excluyen del conteo de profundidad — solo cuentan los segmentos literales de nombre de recurso.
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
@@ -7,7 +8,7 @@ Ejemplo de código no compatible (OpenAPI 2)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
+ /customers/{customerId}/invoices/{invoiceId}/products:
get:
parameters:
- in: path
@@ -21,7 +22,7 @@ Ejemplo de código no compatible (OpenAPI 2)
responses:
200:
description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
parameters:
- in: path
@@ -73,6 +74,20 @@ Solución compatible (OpenAPI 2)
responses:
200:
description: OK
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
+ - in: path
+ name: invoiceId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: OK
Ejemplo de código no compatible (OpenAPI 3)
@@ -81,7 +96,7 @@ Ejemplo de código no compatible (OpenAPI 3)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
+ /customers/{customerId}/invoices/{invoiceId}/products:
get:
parameters:
- name: customerId
@@ -97,7 +112,7 @@ Ejemplo de código no compatible (OpenAPI 3)
responses:
200:
description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
parameters:
- name: customerId
@@ -154,4 +169,20 @@ Solución compatible (OpenAPI 3)
responses:
200:
description: OK
-
\ No newline at end of file
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
+ - name: invoiceId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: OK
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR015.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR015.html
index ff5c8018..19274297 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR015.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR015.html
@@ -1,5 +1,6 @@
Una ruta compleja puede ser una insinuación para detectar definiciones de API incorrectas.
El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta sea mayor o igual a 6 se mostrará un error.
+Nota: Los parámetros de ruta (p.ej. {customerId}) se excluyen del conteo de profundidad — solo cuentan los segmentos literales de nombre de recurso.
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
@@ -7,7 +8,7 @@ Ejemplo de código no compatible (OpenAPI 2)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- in: path
@@ -18,10 +19,6 @@ Ejemplo de código no compatible (OpenAPI 2)
name: invoiceId
type: integer
required: true
- - in: path
- name: productId
- type: integer
- required: true
responses:
200:
description: OK
@@ -53,19 +50,17 @@ Solución compatible (OpenAPI 2)
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
- in: path
name: invoiceId
type: integer
required: true
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- in: path
name: productId
type: integer
@@ -81,7 +76,7 @@ Ejemplo de código no compatible (OpenAPI 3)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- name: customerId
@@ -94,11 +89,6 @@ Ejemplo de código no compatible (OpenAPI 3)
required: true
schema:
type: integer
- - name: productId
- in: path
- required: true
- schema:
- type: integer
responses:
200:
description: OK
@@ -132,20 +122,19 @@ Solución compatible (OpenAPI 3)
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
- name: invoiceId
in: path
required: true
schema:
type: integer
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- name: productId
in: path
required: true
@@ -154,4 +143,4 @@ Solución compatible (OpenAPI 3)
responses:
200:
description: OK
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR017.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR017.html
index d586b013..668d7d4e 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR017.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR017.html
@@ -1,13 +1,10 @@
-Se valida que cada ruta alterna sus partes entre partes estáticas y variables, empezando por las partes estáticas.
-Ejemplos:
+Se valida que cada ruta alterna sus partes entre partes estáticas y variables, empezando por las partes estáticas. Esta regla es idéntica a la implementación Spectral.
+Esta regla dispara cuando:
- - /{id} -> Error
- - /facturas/{id}/{lineId} -> Error
- - /facturas/{id} -> Ok
- - /facturas/get -> Ok
- - /facturas/{id}/lineas/{lineId} -> Ok
- - /facturas/{id}/lineas/get -> Ok
+ - Aparecen dos segmentos consecutivos del mismo tipo: dos segmentos estáticos (p.ej.
/a/b) o dos parámetros de ruta (p.ej. /{a}/{b}).
+ - El path empieza por un parámetro de ruta (p.ej.
/{id}/items).
+Configurable: exclude_patterns (por defecto: get,me,search) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR038.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR038.html
index 398febec..f26af29f 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR038.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/operations/OAR038.html
@@ -1,4 +1,11 @@
-Una respuesta de creación de recurso debe contar con al menos un atributo.
+El schema de la respuesta 201 de una operación POST debe tener propiedades llamadas data o error, y cada una debe tener al menos una sub-propiedad.
+Esta regla dispara cuando:
+
+- Una propiedad de nivel superior no se llama exactamente
data o error (sensible a mayúsculas).
+- Una propiedad
data o error no tiene sub-propiedades.
+- La respuesta 201 no tiene schema.
+
+Configurable: data-property — nombre de propiedad válido (por defecto: data; también acepta error).
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/owasp/OAR073.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/owasp/OAR073.html
index 81835097..c76ad1b7 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/owasp/OAR073.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/owasp/OAR073.html
@@ -1,4 +1,15 @@
La API debería incluir una respuesta 429 (demasiadas solicitudes) para indicar la limitación de la tasa
+Paths excluidos
+Los siguientes paths de health-check están excluidos de esta regla por defecto:
+
+ /status
+ /health
+ /health-check
+ /ping
+ /liveness
+ /readiness
+
+Esta lista es configurable mediante el parámetro de regla paths.
Ejemplo de código no compatible (OpenAPI 2)
swagger: '2.0'
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR020.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR020.html
index 577fc1d4..cc1a5895 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR020.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR020.html
@@ -1,101 +1,115 @@
-El parámetro elegido debe definirse en esta operación. Por defecto, $expand
+Toda operación GET de colección debe definir $expand como parámetro de consulta.
+Se aplica a: operaciones GET en rutas de colección (rutas que no terminan en un parámetro de ruta como /{id}).
+Excluidos automáticamente: endpoints de detalle (ruta termina en /{param}), rutas que contienen /me, y rutas de health-check que contienen status, health o ping.
+Parámetros configurables:
+
+ paths — lista de rutas a incluir/excluir separadas por coma (por defecto: /examples).
+ pathValidationStrategy — /include o /exclude (por defecto: /include).
+
Ejemplo de código no compatible (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other
- type: array
- items:
- type: string
- - in: query
- name: hola
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
-Compliant Solution (OpenAPI 2)
+Solución compatible (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $expand
- type: array
- items:
- type: string
- - in: query
- name: $expand
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - in: path
+ name: petId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: Ok
-Noncompliant Code Example (OpenAPI 3)
+Ejemplo de código no compatible (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other
- schema:
- type: array
- items:
- type: string
- - in: query
- name: select
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ "206":
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ "206":
+ description: Ok
-Compliant Solution (OpenAPI 3)
+Solución compatible (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $expand
- schema:
- type: array
- items:
- type: string
- - in: query
- name: $expand
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
-
\ No newline at end of file
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "206":
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ "200":
+ description: Ok
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR021.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR021.html
index 5ab8509d..d6fac197 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR021.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR021.html
@@ -1,101 +1,115 @@
-El parámetro elegido debe definirse en esta operación. Por defecto, $exclude
+Toda operación GET de colección debe definir $exclude como parámetro de consulta.
+Se aplica a: operaciones GET en rutas de colección (rutas que no terminan en un parámetro de ruta como /{id}).
+Excluidos automáticamente: endpoints de detalle (ruta termina en /{param}), rutas que contienen /me, y rutas de health-check que contienen status, health o ping.
+Parámetros configurables:
+
+ paths — lista de rutas a incluir/excluir separadas por coma (por defecto: /examples).
+ pathValidationStrategy — /include o /exclude (por defecto: /include).
+
Ejemplo de código no compatible (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other
- type: array
- items:
- type: string
- - in: query
- name: hola
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
-Compliant Solution (OpenAPI 2)
+Solución compatible (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $exclude
- type: array
- items:
- type: string
- - in: query
- name: $exclude
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - in: path
+ name: petId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: Ok
-Noncompliant Code Example (OpenAPI 3)
+Ejemplo de código no compatible (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other
- schema:
- type: array
- items:
- type: string
- - in: query
- name: select
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ "206":
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ "206":
+ description: Ok
-Compliant Solution (OpenAPI 3)
+Solución compatible (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $exclude
- schema:
- type: array
- items:
- type: string
- - in: query
- name: $exclude
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
-
\ No newline at end of file
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "206":
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ "200":
+ description: Ok
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR028.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR028.html
index 0319e27e..18e944be 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR028.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR028.html
@@ -1,4 +1,4 @@
-The chosen parameter must be defined in this operation. By default, $filter
+El parámetro de consulta $filter debe estar presente en las operaciones GET de colección. Se genera un único issue por operación a la que le falta el parámetro $filter.
Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0"
@@ -7,15 +7,10 @@ Ejemplo de código no compatible (OpenAPI 2)
title: Swagger Petstore
paths:
/pets:
- get:
- parameters:
- - in: query
- name: other
- type: array
- items:
- type: string
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: hola
+ name: other
type: array
items:
type: string
@@ -23,7 +18,7 @@ Ejemplo de código no compatible (OpenAPI 2)
206:
description: Ok
-Compliant Solution (OpenAPI 2)
+Solución compatible (OpenAPI 2)
swagger: "2.0"
info:
@@ -38,16 +33,11 @@ Compliant Solution (OpenAPI 2)
type: array
items:
type: string
- - in: query
- name: $filter
- type: array
- items:
- type: string
responses:
206:
description: Ok
-Noncompliant Code Example (OpenAPI 3)
+Ejemplo de código no compatible (OpenAPI 3)
openapi: "3.0.0"
info:
@@ -55,16 +45,10 @@ Noncompliant Code Example (OpenAPI 3)
title: Swagger Petstore
paths:
/pets:
- get:
- parameters:
- - in: query
- name: other
- schema:
- type: array
- items:
- type: string
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: select
+ name: other
schema:
type: array
items:
@@ -73,7 +57,7 @@ Noncompliant Code Example (OpenAPI 3)
206:
description: Ok
-Compliant Solution (OpenAPI 3)
+Solución compatible (OpenAPI 3)
openapi: "3.0.0"
info:
@@ -89,13 +73,7 @@ Compliant Solution (OpenAPI 3)
type: array
items:
type: string
- - in: query
- name: $filter
- schema:
- type: array
- items:
- type: string
responses:
206:
description: Ok
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR014.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR014.html
index 62819921..7542bc69 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR014.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR014.html
@@ -1,54 +1,32 @@
Una ruta compleja puede ser una insinuación para detectar definiciones de API incorrectas.
-El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta este entre 4 y 5 se mostrará una advertencia.
+El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta esté entre 4 y 5 se mostrará una advertencia.
+Nota: Los parámetros de ruta (p.ej. {customerId}) se excluyen del conteo de profundidad — solo cuentan los segmentos literales de nombre de recurso.
Ejemplo de código no compatible (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "customerId",
- "type": "integer",
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
"required": true
- },
+ },
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/customers/{customerId}/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -66,21 +44,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
- get:
- parameters:
- - in: path
- name: customerId
- type: integer
- required: true
- - in: path
- name: invoiceId
- type: integer
- required: true
- responses:
- 200:
- description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details:
get:
parameters:
- in: path
@@ -99,56 +63,79 @@ Solución compatible (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "customerId",
- "type": "integer",
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
"required": true
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}/products": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products": {
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
+ "required": true
+ },
+ {
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
+ "required": true
+ }
+ ],
"responses": {
"200": {
"description": "OK"
@@ -196,64 +183,51 @@ YAML
responses:
200:
description: OK
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
+ - in: path
+ name: invoiceId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: OK
Ejemplo de código no compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details": {
"get": {
"parameters": [
{
- "name": "customerId",
- "in": "path",
- "required": true,
+ "name": "customerId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
- },
+ },
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/customers/{customerId}/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -271,23 +245,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
- get:
- parameters:
- - name: customerId
- in: path
- required: true
- schema:
- type: integer
- - name: invoiceId
- in: path
- required: true
- schema:
- type: integer
- responses:
- 200:
- description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details:
get:
parameters:
- name: customerId
@@ -308,62 +266,89 @@ Solución compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
{
- "name": "customerId",
- "in": "path",
- "required": true,
+ "name": "customerId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}/products": {
"get": {
"parameters": [
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products": {
+ "get": {
+ "parameters": [
+ {
+ "name": "customerId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -414,4 +399,20 @@ YAML
responses:
200:
description: OK
-
\ No newline at end of file
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
+ - name: invoiceId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: OK
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR015.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR015.html
index a30a70c3..3ce2860e 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR015.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR015.html
@@ -1,42 +1,23 @@
Una ruta compleja puede ser una insinuación para detectar definiciones de API incorrectas.
El número de partes de la ruta debe ser menor a 4, cuando el número de partes de la ruta sea mayor o igual a 6 se mostrará un error.
+Nota: Los parámetros de ruta (p.ej. {customerId}) se excluyen del conteo de profundidad — solo cuentan los segmentos literales de nombre de recurso.
Ejemplo de código no compatible (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details/versions": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "productId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true },
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -49,7 +30,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- in: path
@@ -60,10 +41,6 @@ YAML
name: invoiceId
type: integer
required: true
- - in: path
- name: productId
- type: integer
- required: true
responses:
200:
description: OK
@@ -72,78 +49,36 @@ Solución compatible (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
- "/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/products/{productId}": {
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "productId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true },
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true },
+ { "in": "path", "name": "productId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -176,19 +111,17 @@ YAML
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
- in: path
name: invoiceId
type: integer
required: true
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- in: path
name: productId
type: integer
@@ -201,45 +134,19 @@ Ejemplo de código no compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details/versions": {
"get": {
"parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "productId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -252,7 +159,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- name: customerId
@@ -265,11 +172,6 @@ YAML
required: true
schema:
type: integer
- - name: productId
- in: path
- required: true
- schema:
- type: integer
responses:
200:
description: OK
@@ -278,86 +180,36 @@ Solución compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
- "/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/products/{productId}": {
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
"get": {
"parameters": [
- {
- "name": "productId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "productId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -392,20 +244,19 @@ YAML
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
- name: invoiceId
in: path
required: true
schema:
type: integer
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- name: productId
in: path
required: true
@@ -414,4 +265,4 @@ YAML
responses:
200:
description: OK
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR017.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR017.html
index 196607d8..b8177471 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR017.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR017.html
@@ -1,13 +1,10 @@
-Se valida que cada ruta alterna sus partes entre partes estáticas y variables, empezando por las partes estáticas.
-Ejemplos:
+Se valida que cada ruta alterna sus partes entre partes estáticas y variables, empezando por las partes estáticas. Esta regla es idéntica a la implementación Spectral.
+Esta regla dispara cuando:
- - /{id} -> Error
- - /facturas/{id}/{lineId} -> Error
- - /facturas/{id} -> Ok
- - /facturas/get -> Ok
- - /facturas/{id}/lineas/{lineId} -> Ok
- - /facturas/{id}/lineas/get -> Ok
+ - Aparecen dos segmentos consecutivos del mismo tipo: dos segmentos estáticos (p.ej.
/a/b) o dos parámetros de ruta (p.ej. /{a}/{b}).
+ - El path empieza por un parámetro de ruta (p.ej.
/{id}/items).
+Configurable: exclude_patterns (por defecto: get,me,search) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
Ejemplo de código no compatible (OpenAPI 2)
JSON
diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR038.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR038.html
index 63e1cae9..b746f554 100644
--- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR038.html
+++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/resources/OAR038.html
@@ -1,4 +1,11 @@
-Una respuesta de creación de recurso debe contar con al menos un atributo.
+El schema de la respuesta 201 de una operación POST debe tener propiedades llamadas data o error, y cada una debe tener al menos una sub-propiedad.
+Esta regla dispara cuando:
+
+- Una propiedad de nivel superior no se llama exactamente
data o error (sensible a mayúsculas).
+- Una propiedad
data o error no tiene sub-propiedades.
+- La respuesta 201 no tiene schema.
+
+Configurable: data-property — nombre de propiedad válido (por defecto: data; también acepta error).
Ejemplo de código no compatible (OpenAPI 2)
JSON
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR037.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR037.html
index 41a863f8..2ec09784 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR037.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR037.html
@@ -1,4 +1,7 @@
-A string type with invalid format or without format may cause developers to use the wrong variable types in the API implementation.
+A string schema without a format, or with an unrecognized format, may cause developers to use the wrong variable types in the API implementation.
+This rule fires when the format field is absent or present but not recognized. Every string schema must declare one of the valid formats.
+Valid formats: date, date-time, password, byte, binary, email, uuid, uri, hostname, ipv4, ipv6, HEX, HEX(16), json, xml, base64.
+Configurable: formats-allowed — comma-separated list of allowed formats (default: the list above).
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
@@ -16,8 +19,10 @@ Noncompliant Code Example (OpenAPI 2)
items:
type: object
properties:
+ name:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}} — no format
date:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types requires a valid format}} — invalid format
format: 'dd/mm/yyyy'
Compliant Solution (OpenAPI 2)
@@ -60,8 +65,10 @@ Noncompliant Code Example (OpenAPI 3)
items:
type: object
properties:
+ name:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}} — no format
date:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types requires a valid format}} — invalid format
format: dd/mm/yyyy
Compliant Solution (OpenAPI 3)
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR066.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR066.html
index be3495ef..adb9055e 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR066.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/format/OAR066.html
@@ -1,4 +1,11 @@
RequestBody and Responses schema property names must be compliant with the snake_case naming convention
+Exempt Prefixes
+The following industry-standard property name prefixes are not subject to this rule:
+
+ _ prefix — HAL/HATEOAS standard fields (_links, _embedded)
+ @ prefix — JSON-LD W3C standard fields (@context, @type, @id)
+ x- prefix — OpenAPI extension conventions (x-internal, x-custom-field)
+
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR014.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR014.html
index 532ded52..fe4414b9 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR014.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR014.html
@@ -1,5 +1,6 @@
A complex path may be a hint to detect wrong API definitions.
The number of parts of the path must be less than 4, when the number of parts of the route is between 4 and 5 a warning will be displayed.
+Note: Path parameters (e.g. {customerId}) are excluded from the depth count — only literal resource name segments count toward the depth.
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
@@ -7,7 +8,7 @@ Noncompliant Code Example (OpenAPI 2)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
+ /customers/{customerId}/invoices/{invoiceId}/products:
get:
parameters:
- in: path
@@ -21,7 +22,7 @@ Noncompliant Code Example (OpenAPI 2)
responses:
200:
description: OK
- /customers/{customerId}/invoices/{invoiceId}/products: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ /customers/{customerId}/invoices/{invoiceId}/products/details: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
parameters:
- in: path
@@ -73,6 +74,20 @@ Compliant Solution (OpenAPI 2)
responses:
200:
description: OK
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
+ - in: path
+ name: invoiceId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: OK
Noncompliant Code Example (OpenAPI 3)
@@ -81,7 +96,7 @@ Noncompliant Code Example (OpenAPI 3)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
+ /customers/{customerId}/invoices/{invoiceId}/products:
get:
parameters:
- name: customerId
@@ -97,7 +112,7 @@ Noncompliant Code Example (OpenAPI 3)
responses:
200:
description: OK
- /customers/{customerId}/invoices/{invoiceId}/products: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ /customers/{customerId}/invoices/{invoiceId}/products/details: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
parameters:
- name: customerId
@@ -154,4 +169,20 @@ Compliant Solution (OpenAPI 3)
responses:
200:
description: OK
-
\ No newline at end of file
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
+ - name: invoiceId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: OK
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR015.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR015.html
index 0a0ac322..ca3714ab 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR015.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR015.html
@@ -1,5 +1,6 @@
A complex path may be a hint to detect wrong API definitions.
The number of parts of the path must be less than 4, when the number of parts of the route is equal or greater than 6 an error will be displayed.
+Note: Path parameters (e.g. {customerId}) are excluded from the depth count — only literal resource name segments count toward the depth.
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
@@ -7,7 +8,7 @@ Noncompliant Code Example (OpenAPI 2)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions: # Noncompliant {{OAR015: Resources depth level should be smaller}}
get:
parameters:
- in: path
@@ -18,10 +19,6 @@ Noncompliant Code Example (OpenAPI 2)
name: invoiceId
type: integer
required: true
- - in: path
- name: productId
- type: integer
- required: true
responses:
200:
description: OK
@@ -53,19 +50,17 @@ Compliant Solution (OpenAPI 2)
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
- in: path
name: invoiceId
type: integer
required: true
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- in: path
name: productId
type: integer
@@ -81,7 +76,7 @@ Noncompliant Code Example (OpenAPI 3)
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions: # Noncompliant {{OAR015: Resources depth level should be smaller}}
get:
parameters:
- name: customerId
@@ -94,11 +89,6 @@ Noncompliant Code Example (OpenAPI 3)
required: true
schema:
type: integer
- - name: productId
- in: path
- required: true
- schema:
- type: integer
responses:
200:
description: OK
@@ -132,20 +122,19 @@ Compliant Solution (OpenAPI 3)
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
- name: invoiceId
in: path
required: true
schema:
type: integer
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- name: productId
in: path
required: true
@@ -154,4 +143,4 @@ Compliant Solution (OpenAPI 3)
responses:
200:
description: OK
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR017.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR017.html
index c235a74b..22bce347 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR017.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR017.html
@@ -1,13 +1,10 @@
-It is validated that each route alternates its parts between static and variable parts, starting with the static parts.
-Examples:
+It is validated that each route alternates its parts between static and variable parts, starting with the static parts. This rule is identical to the Spectral implementation.
+Specifically, this rule fires when:
-- /{id} -> Error
-- /facturas/{id}/{lineId} -> Error
-- /facturas/{id} -> Ok
-- /facturas/get -> Ok
-- /facturas/{id}/lineas/{lineId} -> Ok
-- /facturas/{id}/lineas/get -> Ok
+- Two consecutive path segments of the same type appear: two static segments (e.g.
/a/b) or two path parameters (e.g. /{a}/{b}).
+- The path starts with a path parameter (e.g.
/{id}/items).
+Configurable: exclude_patterns (default: get,me,search) — segments treated as pseudo-parameters that do not break the alternation rule.
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR038.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR038.html
index eed82fd6..485922da 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR038.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/operations/OAR038.html
@@ -1,4 +1,11 @@
-A resource creation response must have at least one attribute.
+The 201 response schema of a POST operation must have properties named data or error, and each must have at least one sub-property.
+This rule fires when:
+
+- A top-level property is not named exactly
data or error (case-sensitive).
+- A
data or error property has no sub-properties.
+- The 201 response has no schema.
+
+Configurable: data-property — valid property name (default: data; also accepts error).
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/owasp/OAR073.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/owasp/OAR073.html
index a7449ba9..7165542f 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/owasp/OAR073.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/owasp/OAR073.html
@@ -1,4 +1,15 @@
API should include a 429 'Too Many Requests' response to indicate rate limiting
+Excluded Paths
+The following health-check paths are excluded from this rule by default:
+
+ /status
+ /health
+ /health-check
+ /ping
+ /liveness
+ /readiness
+
+This list is configurable via the paths rule parameter.
Noncompliant Code Example (OpenAPI 2)
swagger: '2.0'
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR020.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR020.html
index e3581981..c8c7dd3e 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR020.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR020.html
@@ -1,101 +1,115 @@
-The chosen parameter must be defined in this operation. By default, $expand
+Every GET collection operation must define $expand as a query parameter.
+Applies to: GET operations on collection paths (paths that do not end with a path parameter such as /{id}).
+Excluded automatically: detail endpoints (path ends with /{param}), paths containing /me, and health-check paths containing status, health, or ping.
+Configurable parameters:
+
+ paths — list of explicit paths to include/exclude (default: /examples).
+ pathValidationStrategy — /include or /exclude (default: /include).
+
Noncompliant Code Example (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
- type: array
- items:
- type: string
- - in: query
- name: hola # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
Compliant Solution (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $expand
- type: array
- items:
- type: string
- - in: query
- name: $expand
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - in: path
+ name: petId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: Ok
Noncompliant Code Example (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
- schema:
- type: array
- items:
- type: string
- - in: query
- name: select # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ "206":
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ "206":
+ description: Ok
Compliant Solution (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $expand
- schema:
- type: array
- items:
- type: string
- - in: query
- name: $expand
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
-
\ No newline at end of file
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "206":
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ "200":
+ description: Ok
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR021.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR021.html
index c4bafab6..c39836cc 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR021.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR021.html
@@ -1,101 +1,115 @@
-The chosen parameter must be defined in this operation. By default, $exclude
+Every GET collection operation must define $exclude as a query parameter.
+Applies to: GET operations on collection paths (paths that do not end with a path parameter such as /{id}).
+Excluded automatically: detail endpoints (path ends with /{param}), paths containing /me, and health-check paths containing status, health, or ping.
+Configurable parameters:
+
+ paths — list of explicit paths to include/exclude (default: /examples).
+ pathValidationStrategy — /include or /exclude (default: /include).
+
Noncompliant Code Example (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
- type: array
- items:
- type: string
- - in: query
- name: hola # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
Compliant Solution (OpenAPI 2)
- swagger: "2.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $exclude
- type: array
- items:
- type: string
- - in: query
- name: $exclude
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - in: path
+ name: petId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: Ok
Noncompliant Code Example (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
- schema:
- type: array
- items:
- type: string
- - in: query
- name: select # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ "206":
+ description: Ok
+ /orders:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ "206":
+ description: Ok
Compliant Solution (OpenAPI 3)
- openapi: "3.0.0"
- info:
- version: 1.0.0
- title: Swagger Petstore
- paths:
- /pets:
- get:
- parameters:
- - in: query
- name: $exclude
- schema:
- type: array
- items:
- type: string
- - in: query
- name: $exclude
- schema:
- type: array
- items:
- type: string
- responses:
- 206:
- description: Ok
-
\ No newline at end of file
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ "206":
+ description: Ok
+ /pets/{petId}:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ "200":
+ description: Ok
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR028.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR028.html
index 228f3060..d7e0171a 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR028.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR028.html
@@ -1,4 +1,4 @@
-The chosen parameter must be defined in this operation. By default, $filter
+The $filter query parameter must be present in GET collection operations. One issue is raised per operation missing the $filter parameter.
Noncompliant Code Example (OpenAPI 2)
swagger: "2.0"
@@ -7,15 +7,10 @@ Noncompliant Code Example (OpenAPI 2)
title: Swagger Petstore
paths:
/pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
- type: array
- items:
- type: string
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: hola # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
type: array
items:
type: string
@@ -38,11 +33,6 @@ Compliant Solution (OpenAPI 2)
type: array
items:
type: string
- - in: query
- name: $filter
- type: array
- items:
- type: string
responses:
206:
description: Ok
@@ -55,16 +45,10 @@ Noncompliant Code Example (OpenAPI 3)
title: Swagger Petstore
paths:
/pets:
- get:
- parameters:
- - in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
- schema:
- type: array
- items:
- type: string
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: select # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
schema:
type: array
items:
@@ -89,13 +73,7 @@ Compliant Solution (OpenAPI 3)
type: array
items:
type: string
- - in: query
- name: $filter
- schema:
- type: array
- items:
- type: string
responses:
206:
description: Ok
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR014.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR014.html
index 8739cc7e..8888fbed 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR014.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR014.html
@@ -1,54 +1,32 @@
A complex path may be a hint to detect wrong API definitions.
The number of parts of the path must be less than 4, when the number of parts of the route is between 4 and 5 a warning will be displayed.
+Note: Path parameters (e.g. {customerId}) are excluded from the depth count — only literal resource name segments count toward the depth.
Noncompliant Code Example (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "customerId",
- "type": "integer",
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
"required": true
- },
+ },
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/customers/{customerId}/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -66,21 +44,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
- get:
- parameters:
- - in: path
- name: customerId
- type: integer
- required: true
- - in: path
- name: invoiceId
- type: integer
- required: true
- responses:
- 200:
- description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details:
get:
parameters:
- in: path
@@ -99,56 +63,79 @@ Compliant Solution (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "customerId",
- "type": "integer",
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
"required": true
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}/products": {
"get": {
"parameters": [
{
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
"required": true
}
- ],
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products": {
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "customerId",
+ "type": "integer",
+ "required": true
+ },
+ {
+ "in": "path",
+ "name": "invoiceId",
+ "type": "integer",
+ "required": true
+ }
+ ],
"responses": {
"200": {
"description": "OK"
@@ -196,64 +183,51 @@ YAML
responses:
200:
description: OK
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
+ - in: path
+ name: invoiceId
+ type: integer
+ required: true
+ responses:
+ 200:
+ description: OK
Noncompliant Code Example (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details": {
"get": {
"parameters": [
{
- "name": "customerId",
- "in": "path",
- "required": true,
+ "name": "customerId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
- },
+ },
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/customers/{customerId}/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -271,23 +245,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}:
- get:
- parameters:
- - name: customerId
- in: path
- required: true
- schema:
- type: integer
- - name: invoiceId
- in: path
- required: true
- schema:
- type: integer
- responses:
- 200:
- description: OK
- /customers/{customerId}/invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/details:
get:
parameters:
- name: customerId
@@ -308,62 +266,89 @@ Compliant Solution (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
{
- "name": "customerId",
- "in": "path",
- "required": true,
+ "name": "customerId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
}
}
}
- },
+ },
"/invoices/{invoiceId}/products": {
"get": {
"parameters": [
{
- "name": "invoiceId",
- "in": "path",
- "required": true,
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products": {
+ "get": {
+ "parameters": [
+ {
+ "name": "customerId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "invoiceId",
+ "in": "path",
+ "required": true,
"schema": {
"type": "integer"
}
}
- ],
+ ],
"responses": {
"200": {
"description": "OK"
@@ -414,4 +399,20 @@ YAML
responses:
200:
description: OK
-
\ No newline at end of file
+ /customers/{customerId}/invoices/{invoiceId}/products:
+ get:
+ parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
+ - name: invoiceId
+ in: path
+ required: true
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: OK
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR015.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR015.html
index 850c3863..07e822bf 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR015.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR015.html
@@ -1,42 +1,23 @@
A complex path may be a hint to detect wrong API definitions.
The number of parts of the path must be less than 4, when the number of parts of the route is equal or greater than 6 an error will be displayed.
+Note: Path parameters (e.g. {customerId}) are excluded from the depth count — only literal resource name segments count toward the depth.
Noncompliant Code Example (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details/versions": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- },
- {
- "in": "path",
- "name": "productId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true },
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -49,7 +30,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- in: path
@@ -60,10 +41,6 @@ YAML
name: invoiceId
type: integer
required: true
- - in: path
- name: productId
- type: integer
- required: true
responses:
200:
description: OK
@@ -72,78 +49,36 @@ Compliant Solution (OpenAPI 2)
JSON
{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "customerId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
- "/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "in": "path",
- "name": "invoiceId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/products/{productId}": {
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
"get": {
"parameters": [
- {
- "in": "path",
- "name": "productId",
- "type": "integer",
- "required": true
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "in": "path", "name": "customerId", "type": "integer", "required": true },
+ { "in": "path", "name": "invoiceId", "type": "integer", "required": true },
+ { "in": "path", "name": "productId", "type": "integer", "required": true }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -176,19 +111,17 @@ YAML
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - in: path
+ name: customerId
+ type: integer
+ required: true
- in: path
name: invoiceId
type: integer
required: true
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- in: path
name: productId
type: integer
@@ -201,45 +134,19 @@ Noncompliant Code Example (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
- "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
+ "/customers/{customerId}/invoices/{invoiceId}/products/details/versions": {
"get": {
"parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- },
- {
- "name": "productId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -252,7 +159,7 @@ YAML
title: Swagger Petstore
version: "1.0"
paths:
- /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
+ /customers/{customerId}/invoices/{invoiceId}/products/details/versions:
get:
parameters:
- name: customerId
@@ -265,11 +172,6 @@ YAML
required: true
schema:
type: integer
- - name: productId
- in: path
- required: true
- schema:
- type: integer
responses:
200:
description: OK
@@ -278,86 +180,36 @@ Compliant Solution (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "title": "Swagger Petstore",
+ "title": "Swagger Petstore",
"version": "1.0"
- },
+ },
"paths": {
"/customers/{customerId}/invoices": {
"get": {
"parameters": [
- {
- "name": "customerId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
+ },
"/invoices/{invoiceId}": {
"get": {
"parameters": [
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
- },
- "/invoices/{invoiceId}/products": {
- "get": {
- "parameters": [
- {
- "name": "invoiceId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
- }
- },
- "/products/{productId}": {
+ },
+ "/customers/{customerId}/invoices/{invoiceId}/products/{productId}": {
"get": {
"parameters": [
- {
- "name": "productId",
- "in": "path",
- "required": true,
- "schema": {
- "type": "integer"
- }
- }
- ],
- "responses": {
- "200": {
- "description": "OK"
- }
- }
+ { "name": "customerId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "invoiceId", "in": "path", "required": true, "schema": { "type": "integer" } },
+ { "name": "productId", "in": "path", "required": true, "schema": { "type": "integer" } }
+ ],
+ "responses": { "200": { "description": "OK" } }
}
}
}
@@ -392,20 +244,19 @@ YAML
responses:
200:
description: OK
- /invoices/{invoiceId}/products:
+ /customers/{customerId}/invoices/{invoiceId}/products/{productId}:
get:
parameters:
+ - name: customerId
+ in: path
+ required: true
+ schema:
+ type: integer
- name: invoiceId
in: path
required: true
schema:
type: integer
- responses:
- 200:
- description: OK
- /products/{productId}:
- get:
- parameters:
- name: productId
in: path
required: true
@@ -414,4 +265,4 @@ YAML
responses:
200:
description: OK
-
\ No newline at end of file
+
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR017.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR017.html
index 309ef068..b33a7d6b 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR017.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR017.html
@@ -1,13 +1,10 @@
-It is validated that each route alternates its parts between static and variable parts, starting with the static parts.
-Examples:
+It is validated that each route alternates its parts between static and variable parts, starting with the static parts. This rule is identical to the Spectral implementation.
+Specifically, this rule fires when:
-- /{id} -> Error
-- /facturas/{id}/{lineId} -> Error
-- /facturas/{id} -> Ok
-- /facturas/get -> Ok
-- /facturas/{id}/lineas/{lineId} -> Ok
-- /facturas/{id}/lineas/get -> Ok
+- Two consecutive path segments of the same type appear: two static segments (e.g.
/a/b) or two path parameters (e.g. /{a}/{b}).
+- The path starts with a path parameter (e.g.
/{id}/items).
+Configurable: exclude_patterns (default: get,me,search) — segments treated as pseudo-parameters that do not break the alternation rule.
Noncompliant Code Example (OpenAPI 2)
JSON
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR038.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR038.html
index 63539536..579bfe9a 100644
--- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR038.html
+++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/resources/OAR038.html
@@ -1,4 +1,11 @@
-A resource creation response must have at least one attribute.
+The 201 response schema of a POST operation must have properties named data or error, and each must have at least one sub-property.
+This rule fires when:
+
+- A top-level property is not named exactly
data or error (case-sensitive).
+- A
data or error property has no sub-properties.
+- The 201 response has no schema.
+
+Configurable: data-property — valid property name (default: data; also accepts error).
Noncompliant Code Example (OpenAPI 2)
JSON
diff --git a/src/test/java/apiaddicts/sonar/openapi/BaseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/BaseCheckTest.java
index f68c63ca..36f52fe7 100644
--- a/src/test/java/apiaddicts/sonar/openapi/BaseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/BaseCheckTest.java
@@ -29,6 +29,7 @@ public abstract class BaseCheckTest {
protected String v2Path;
protected String v3Path;
protected String v31Path;
+ protected String v32Path;
protected String getV2Path(String prefix) {
return "src/test/resources/checks/v2/" + prefix + "/" + ruleName + "/";
@@ -42,24 +43,34 @@ protected String getV31Path(String prefix) {
return "src/test/resources/checks/v31/" + prefix + "/" + ruleName + "/";
}
+ protected String getV32Path(String prefix) {
+ return "src/test/resources/checks/v32/" + prefix + "/" + ruleName + "/";
+ }
+
protected void verifyV2(String file) {
- verify(file, true, false, false);
+ verify(file, true, false, false, false);
}
protected void verifyV3(String file) {
- verify(file, false, true, false);
+ verify(file, false, true, false, false);
}
protected void verifyV31(String file) {
- verify(file, false, false, true);
+ verify(file, false, false, true, false);
+ }
+
+ protected void verifyV32(String file) {
+ verify(file, false, false, false, true);
}
- private void verify(String file, boolean isV2, boolean isV3, boolean isV31) {
+ private void verify(String file, boolean isV2, boolean isV3, boolean isV31, boolean isV32) {
String filePath;
if (isV2) {
filePath = v2Path + file;
} else if (isV31) {
filePath = v31Path + file;
+ } else if (isV32) {
+ filePath = v32Path + file;
} else if (isV3) {
filePath = v3Path + file;
} else {
@@ -68,12 +79,12 @@ private void verify(String file, boolean isV2, boolean isV3, boolean isV31) {
if (filePath.contains(".")) {
LOG.info("Testing file : " + filePath);
- ExtendedOpenApiCheckVerifier.verify(filePath, check, isV2, isV3, isV31);
+ ExtendedOpenApiCheckVerifier.verify(filePath, check, isV2, isV3, isV31, isV32);
} else {
LOG.info("Testing file : " + filePath + ".yaml");
- ExtendedOpenApiCheckVerifier.verify(filePath + ".yaml", check, isV2, isV3, isV31);
+ ExtendedOpenApiCheckVerifier.verify(filePath + ".yaml", check, isV2, isV3, isV31, isV32);
LOG.info("Testing file : " + filePath + ".json");
- ExtendedOpenApiCheckVerifier.verify(filePath + ".json", check, isV2, isV3, isV31);
+ ExtendedOpenApiCheckVerifier.verify(filePath + ".json", check, isV2, isV3, isV31, isV32);
}
}
@@ -85,7 +96,7 @@ public static void beforeClass() {
OpenAPICustomRulesDefinition rulesDefinition = new OpenAPICustomRulesDefinition();
RulesDefinition.Context context = new RulesDefinition.Context();
rulesDefinition.define(context);
- repository = context.repository(OpenAPICustomRulesDefinition.REPOSITORY_KEY);
+ repository = context.repository(OpenAPICustomRulesDefinition.YAML_REPOSITORY_KEY);
}
@Test
diff --git a/src/test/java/apiaddicts/sonar/openapi/ExtendedOpenApiCheckVerifier.java b/src/test/java/apiaddicts/sonar/openapi/ExtendedOpenApiCheckVerifier.java
index 7867ff53..a60e1696 100644
--- a/src/test/java/apiaddicts/sonar/openapi/ExtendedOpenApiCheckVerifier.java
+++ b/src/test/java/apiaddicts/sonar/openapi/ExtendedOpenApiCheckVerifier.java
@@ -30,16 +30,16 @@ public ExtendedOpenApiCheckVerifier() {
// Intentional blank
}
- public static List scanFileForIssues(File file, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31) {
- return check.scanFileForIssues(TestOpenApiVisitorRunner.createContext(file, isV2, isV3, isV31));
+ public static List scanFileForIssues(File file, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31, boolean isV32) {
+ return check.scanFileForIssues(TestOpenApiVisitorRunner.createContext(file, isV2, isV3, isV31, isV32));
}
- public static void verify(String path, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31) {
+ public static void verify(String path, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31, boolean isV32) {
ExtendedOpenApiCheckVerifier verifier = new ExtendedOpenApiCheckVerifier();
OpenApiVisitor collector = new ExtendedOpenApiCheckVerifier.ExpectedIssueCollector(verifier);
File file = new File(path);
- TestOpenApiVisitorRunner.scanFileForComments(file, isV2, isV3, isV31, new OpenApiVisitor[]{collector});
- Iterator actualIssues = getActualIssues(file, check, isV2, isV3, isV31);
+ TestOpenApiVisitorRunner.scanFileForComments(file, isV2, isV3, isV31, isV32, new OpenApiVisitor[]{collector});
+ Iterator actualIssues = getActualIssues(file, check, isV2, isV3, isV31, isV32);
verifier.checkIssues(actualIssues);
if (actualIssues.hasNext()) {
PreciseIssue issue = (PreciseIssue) actualIssues.next();
@@ -112,8 +112,8 @@ private static List secondary(PreciseIssue issue) {
return Ordering.natural().sortedCopy(result);
}
- private static Iterator getActualIssues(File file, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31) {
- List issues = scanFileForIssues(file, check, isV2, isV3, isV31);
+ private static Iterator getActualIssues(File file, OpenApiCheck check, boolean isV2, boolean isV3, boolean isV31, boolean isV32) {
+ List issues = scanFileForIssues(file, check, isV2, isV3, isV31, isV32);
List sortedIssues = Ordering.natural().onResultOf(ExtendedOpenApiCheckVerifier::line).sortedCopy(issues);
return sortedIssues.iterator();
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomJsonRuleRepositoryTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomJsonRuleRepositoryTest.java
new file mode 100644
index 00000000..21a403da
--- /dev/null
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomJsonRuleRepositoryTest.java
@@ -0,0 +1,22 @@
+package apiaddicts.sonar.openapi;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+
+import apiaddicts.sonar.openapi.checks.RulesLists;
+
+public class OpenAPICustomJsonRuleRepositoryTest {
+
+ @Test
+ public void testRepositoryKey() {
+ OpenAPICustomJsonRuleRepository repository = new OpenAPICustomJsonRuleRepository();
+ assertThat(repository.repositoryKey()).isEqualTo(OpenAPICustomRulesDefinition.JSON_REPOSITORY_KEY);
+ }
+
+ @Test
+ public void testCheckClasses() {
+ OpenAPICustomJsonRuleRepository repository = new OpenAPICustomJsonRuleRepository();
+ assertThat(repository.checkClasses()).isEqualTo(RulesLists.getAllChecks());
+ assertThat(repository.checkClasses()).isNotEmpty();
+ }
+}
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomOpenApiRuleRepositoryTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomOpenApiRuleRepositoryTest.java
new file mode 100644
index 00000000..34d65499
--- /dev/null
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomOpenApiRuleRepositoryTest.java
@@ -0,0 +1,26 @@
+package apiaddicts.sonar.openapi;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.junit.Test;
+
+public class OpenAPICustomOpenApiRuleRepositoryTest {
+
+ @Test
+ public void testRepositoryKey() {
+ OpenAPICustomOpenApiRuleRepository repository = new OpenAPICustomOpenApiRuleRepository();
+ assertThat(repository.repositoryKey()).isEqualTo("openapi-custom");
+ }
+
+ @Test
+ public void testCheckClassesNotEmpty() {
+ OpenAPICustomOpenApiRuleRepository repository = new OpenAPICustomOpenApiRuleRepository();
+ assertThat(repository.checkClasses()).isNotEmpty();
+ }
+
+ @Test
+ public void testCheckClassesSameAsAllChecks() {
+ OpenAPICustomOpenApiRuleRepository repository = new OpenAPICustomOpenApiRuleRepository();
+ OpenAPICustomRuleRepository yamlRepo = new OpenAPICustomRuleRepository();
+ assertThat(repository.checkClasses()).isEqualTo(yamlRepo.checkClasses());
+ }
+}
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomPluginTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomPluginTest.java
index db247fca..8225eac6 100644
--- a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomPluginTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomPluginTest.java
@@ -22,10 +22,12 @@ public void testDefine() {
};
Plugin.Context context = new Plugin.Context(runtime);
plugin.define(context);
- assertThat(context.getExtensions()).hasSize(3);
+ assertThat(context.getExtensions()).hasSize(5);
assertThat(context.getExtensions()).contains(
OpenAPICustomProfileDefinition.class,
OpenAPICustomRulesDefinition.class,
- OpenAPICustomRuleRepository.class);
+ OpenAPICustomRuleRepository.class,
+ OpenAPICustomJsonRuleRepository.class,
+ OpenAPICustomOpenApiRuleRepository.class);
}
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinitionTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinitionTest.java
index 904cf042..3cf3b80c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinitionTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomProfileDefinitionTest.java
@@ -1,6 +1,7 @@
package apiaddicts.sonar.openapi;
import static org.assertj.core.api.Assertions.assertThat;
+import org.apiaddicts.apitools.dosonarapi.checks.CheckList;
import org.junit.Test;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition.BuiltInQualityProfile;
@@ -15,12 +16,28 @@ public void testDefine() {
OpenAPICustomProfileDefinition profileDefinition = new OpenAPICustomProfileDefinition();
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
profileDefinition.define(context);
- BuiltInQualityProfile profile = context.profile("openapi", OpenAPICustomProfileDefinition.MY_COMPANY_WAY);
- assertThat(profile).isNotNull();
- assertThat(profile.language()).isEqualTo("openapi");
- assertThat(profile.name()).isEqualTo(OpenAPICustomProfileDefinition.MY_COMPANY_WAY);
- assertThat(profile.rules()).hasSize(RulesLists.getAllChecks().size() - 1);
- assertThat(profile.rules().stream().noneMatch(r -> r.ruleKey().equals("OAR112"))).isTrue();
+ int expectedSize = CheckList.getChecks().size() + RulesLists.getAllChecks().size() - 1;
+
+ BuiltInQualityProfile yamlProfile = context.profile("yaml", OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(yamlProfile).isNotNull();
+ assertThat(yamlProfile.language()).isEqualTo("yaml");
+ assertThat(yamlProfile.name()).isEqualTo(OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(yamlProfile.rules()).hasSize(expectedSize);
+ assertThat(yamlProfile.rules().stream().noneMatch(r -> r.ruleKey().equals("OAR112"))).isTrue();
+
+ BuiltInQualityProfile jsonProfile = context.profile("json", OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(jsonProfile).isNotNull();
+ assertThat(jsonProfile.language()).isEqualTo("json");
+ assertThat(jsonProfile.name()).isEqualTo(OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(jsonProfile.rules()).hasSize(expectedSize);
+ assertThat(jsonProfile.rules().stream().noneMatch(r -> r.ruleKey().equals("OAR112"))).isTrue();
+
+ BuiltInQualityProfile openapiProfile = context.profile("openapi", OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(openapiProfile).isNotNull();
+ assertThat(openapiProfile.language()).isEqualTo("openapi");
+ assertThat(openapiProfile.name()).isEqualTo(OpenAPICustomProfileDefinition.OPENAPI_WAY);
+ assertThat(openapiProfile.rules()).hasSize(expectedSize);
+ assertThat(openapiProfile.rules().stream().noneMatch(r -> r.ruleKey().equals("OAR112"))).isTrue();
}
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepositoryTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepositoryTest.java
index 180b70cd..d54ef603 100644
--- a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepositoryTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRuleRepositoryTest.java
@@ -10,7 +10,7 @@ public class OpenAPICustomRuleRepositoryTest {
@Test
public void testRepositoryKey() {
OpenAPICustomRuleRepository repository = new OpenAPICustomRuleRepository();
- assertThat(repository.repositoryKey()).isEqualTo(OpenAPICustomRulesDefinition.REPOSITORY_KEY);
+ assertThat(repository.repositoryKey()).isEqualTo(OpenAPICustomRulesDefinition.YAML_REPOSITORY_KEY);
}
@Test
diff --git a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinitionTest.java b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinitionTest.java
index e507fcb3..f8e2d86b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinitionTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/OpenAPICustomRulesDefinitionTest.java
@@ -16,10 +16,21 @@ public void testRepository() {
OpenAPICustomRulesDefinition rulesDefinition = new OpenAPICustomRulesDefinition();
RulesDefinition.Context context = new RulesDefinition.Context();
rulesDefinition.define(context);
- Repository repository = context.repository(OpenAPICustomRulesDefinition.REPOSITORY_KEY);
- assertThat(repository.name()).isEqualTo("OpenAPI Custom");
- assertThat(repository.language()).isEqualTo("openapi");
- assertThat(repository.rules()).hasSize(RulesLists.getAllChecks().size());
+
+ Repository yamlRepository = context.repository(OpenAPICustomRulesDefinition.YAML_REPOSITORY_KEY);
+ assertThat(yamlRepository.name()).isEqualTo("OpenAPI Custom");
+ assertThat(yamlRepository.language()).isEqualTo("yaml");
+ assertThat(yamlRepository.rules()).hasSize(RulesLists.getAllChecks().size());
+
+ Repository jsonRepository = context.repository(OpenAPICustomRulesDefinition.JSON_REPOSITORY_KEY);
+ assertThat(jsonRepository.name()).isEqualTo("OpenAPI Custom");
+ assertThat(jsonRepository.language()).isEqualTo("json");
+ assertThat(jsonRepository.rules()).hasSize(RulesLists.getAllChecks().size());
+
+ Repository openapiRepository = context.repository(OpenAPICustomRulesDefinition.OPENAPI_REPOSITORY_KEY);
+ assertThat(openapiRepository.name()).isEqualTo("OpenAPI Custom");
+ assertThat(openapiRepository.language()).isEqualTo("openapi");
+ assertThat(openapiRepository.rules()).hasSize(RulesLists.getAllChecks().size());
}
@Test
@@ -39,7 +50,7 @@ public void testMarkAsTemplateWithNonExistentRule() throws Exception {
I18nContext.setLang("en");
OpenAPICustomRulesDefinition rulesDefinition = new OpenAPICustomRulesDefinition();
RulesDefinition.Context context = new RulesDefinition.Context();
- RulesDefinition.NewRepository newRepo = context.createRepository("test-repo", "openapi").setName("Test");
+ RulesDefinition.NewRepository newRepo = context.createRepository("test-repo", "yaml").setName("Test");
Method method = OpenAPICustomRulesDefinition.class.getDeclaredMethod(
"markAsTemplate", RulesDefinition.NewRepository.class, String.class);
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR002ValidWso2ScopesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR002ValidWso2ScopesCheckTest.java
index 7a11a847..dbdc0cb9 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR002ValidWso2ScopesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR002ValidWso2ScopesCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR002ValidWso2ScopesCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -45,26 +47,66 @@ public void verifyInV2WithoutSecurity() {
public void verifyInV3WithScopes() {
verifyV3("with-scopes");
}
+ @Test
+ public void verifyInV31WithScopes() {
+ verifyV31("with-scopes");
+ }
+ @Test
+ public void verifyInV32WithScopes() {
+ verifyV32("with-scopes");
+ }
@Test
public void verifyInV3WithNullScopes() {
verifyV3("with-null-scopes");
}
+ @Test
+ public void verifyInV31WithNullScopes() {
+ verifyV31("with-null-scopes");
+ }
+ @Test
+ public void verifyInV32WithNullScopes() {
+ verifyV32("with-null-scopes");
+ }
@Test
public void verifyInV3WithEmptyScopes() {
verifyV3("with-empty-scopes");
}
+ @Test
+ public void verifyInV31WithEmptyScopes() {
+ verifyV31("with-empty-scopes");
+ }
+ @Test
+ public void verifyInV32WithEmptyScopes() {
+ verifyV32("with-empty-scopes");
+ }
@Test
public void verifyInV3WithoutScopes() {
verifyV3("without-scopes");
}
+ @Test
+ public void verifyInV31WithoutScopes() {
+ verifyV31("without-scopes");
+ }
+ @Test
+ public void verifyInV32WithoutScopes() {
+ verifyV32("without-scopes");
+ }
@Test
public void verifyInV3WithoutSecurity() {
verifyV3("without-security");
}
+ @Test
+ public void verifyInV31WithoutSecurity() {
+ verifyV31("without-security");
+ }
+ @Test
+ public void verifyInV32WithoutSecurity() {
+ verifyV32("without-security");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR003DefinedWso2ScopesDescriptionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR003DefinedWso2ScopesDescriptionCheckTest.java
index ea1eb22c..2cbf3ffb 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR003DefinedWso2ScopesDescriptionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR003DefinedWso2ScopesDescriptionCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR003DefinedWso2ScopesDescriptionCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2WithNullScopeDescription() {
public void verifyInV3WithScopeDescription() {
verifyV3("with-description");
}
+ @Test
+ public void verifyInV31WithScopeDescription() {
+ verifyV31("with-description");
+ }
+ @Test
+ public void verifyInV32WithScopeDescription() {
+ verifyV32("with-description");
+ }
@Test
public void verifyInV3WithoutScopeDescription() {
verifyV3("without-description");
}
+ @Test
+ public void verifyInV31WithoutScopeDescription() {
+ verifyV31("without-description");
+ }
+ @Test
+ public void verifyInV32WithoutScopeDescription() {
+ verifyV32("without-description");
+ }
@Test
public void verifyInV3WithNullScopeDescription() {
verifyV3("with-null-description");
}
+ @Test
+ public void verifyInV31WithNullScopeDescription() {
+ verifyV31("with-null-description");
+ }
+ @Test
+ public void verifyInV32WithNullScopeDescription() {
+ verifyV32("with-null-description");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR004ValidWso2ScopesRolesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR004ValidWso2ScopesRolesCheckTest.java
index 7db44d7f..2f85ad7c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR004ValidWso2ScopesRolesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR004ValidWso2ScopesRolesCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR004ValidWso2ScopesRolesCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -31,11 +33,67 @@ public void verifyInV2WithInvalidRoles() {
public void verifyInV3WithValidRoles() {
verifyV3("with-valid-roles");
}
+ @Test
+ public void verifyInV31WithValidRoles() {
+ verifyV31("with-valid-roles");
+ }
+ @Test
+ public void verifyInV32WithValidRoles() {
+ verifyV32("with-valid-roles");
+ }
@Test
public void verifyInV3WithInvalidRoles() {
verifyV3("with-invalid-roles");
}
+ @Test
+ public void verifyInV31WithInvalidRoles() {
+ verifyV31("with-invalid-roles");
+ }
+ @Test
+ public void verifyInV32WithInvalidRoles() {
+ verifyV32("with-invalid-roles");
+ }
+
+ @Test
+ public void verifyInV2WithValidArrayRoles() {
+ verifyV2("with-valid-array-roles");
+ }
+
+ @Test
+ public void verifyInV2WithInvalidArrayRoles() {
+ verifyV2("with-invalid-array-roles");
+ }
+
+ @Test
+ public void verifyInV3WithValidArrayRoles() {
+ verifyV3("with-valid-array-roles");
+ }
+
+ @Test
+ public void verifyInV3WithInvalidArrayRoles() {
+ verifyV3("with-invalid-array-roles");
+ }
+
+ @Test
+ public void verifyInV31WithValidArrayRoles() {
+ verifyV31("with-valid-array-roles");
+ }
+
+ @Test
+ public void verifyInV31WithInvalidArrayRoles() {
+ verifyV31("with-invalid-array-roles");
+ }
+
+ @Test
+ public void verifyInV32WithValidArrayRoles() {
+ verifyV32("with-valid-array-roles");
+ }
+
+ @Test
+ public void verifyInV32WithInvalidArrayRoles() {
+ verifyV32("with-invalid-array-roles");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR005UndefinedWso2ScopeUseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR005UndefinedWso2ScopeUseCheckTest.java
index cc684493..d569214d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR005UndefinedWso2ScopeUseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR005UndefinedWso2ScopeUseCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR005UndefinedWso2ScopeUseCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2WithCorrectOperationScope() {
public void verifyInV3WithNullOperationScope() {
verifyV3("with-null-operation-scope");
}
+ @Test
+ public void verifyInV31WithNullOperationScope() {
+ verifyV31("with-null-operation-scope");
+ }
+ @Test
+ public void verifyInV32WithNullOperationScope() {
+ verifyV32("with-null-operation-scope");
+ }
@Test
public void verifyInV3WithWrongOperationScope() {
verifyV3("with-wrong-operation-scope");
}
+ @Test
+ public void verifyInV31WithWrongOperationScope() {
+ verifyV31("with-wrong-operation-scope");
+ }
+ @Test
+ public void verifyInV32WithWrongOperationScope() {
+ verifyV32("with-wrong-operation-scope");
+ }
@Test
public void verifyInV3WithCorrectOperationScope() {
verifyV3("with-correct-operation-scope");
}
+ @Test
+ public void verifyInV31WithCorrectOperationScope() {
+ verifyV31("with-correct-operation-scope");
+ }
+ @Test
+ public void verifyInV32WithCorrectOperationScope() {
+ verifyV32("with-correct-operation-scope");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR040StandardWso2ScopesNameCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR040StandardWso2ScopesNameCheckTest.java
index 49c38eda..19ec1e90 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR040StandardWso2ScopesNameCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR040StandardWso2ScopesNameCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR040StandardWso2ScopesNameCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2WithInvalidNames() {
public void verifyInV3WithValidNames() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31WithValidNames() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32WithValidNames() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithInvalidNames() {
verifyV3("invalid");
}
+ @Test
+ public void verifyInV31WithInvalidNames() {
+ verifyV31("invalid");
+ }
+ @Test
+ public void verifyInV32WithInvalidNames() {
+ verifyV32("invalid");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR041UndefinedAuthTypeForWso2ScopeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR041UndefinedAuthTypeForWso2ScopeCheckTest.java
index 840c9835..101d2af6 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR041UndefinedAuthTypeForWso2ScopeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/apim/wso2/OAR041UndefinedAuthTypeForWso2ScopeCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR041UndefinedAuthTypeForWso2ScopeCheck();
v2Path = getV2Path("apim/wso2");
v3Path = getV3Path("apim/wso2");
+ v31Path = getV31Path("apim");
+ v32Path = getV32Path("apim");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2WithoutScopeAndAuth() {
public void verifyInV3WithScopeAndAuth() {
verifyV3("with-scope-and-auth");
}
+ @Test
+ public void verifyInV31WithScopeAndAuth() {
+ verifyV31("with-scope-and-auth");
+ }
+ @Test
+ public void verifyInV32WithScopeAndAuth() {
+ verifyV32("with-scope-and-auth");
+ }
@Test
public void verifyInV3WithScopeWithoutAuth() {
verifyV3("with-scope-without-auth");
}
+ @Test
+ public void verifyInV31WithScopeWithoutAuth() {
+ verifyV31("with-scope-without-auth");
+ }
+ @Test
+ public void verifyInV32WithScopeWithoutAuth() {
+ verifyV32("with-scope-without-auth");
+ }
@Test
public void verifyInV3WithoutScopeAndAuth() {
verifyV3("without-scope-and-auth");
}
+ @Test
+ public void verifyInV31WithoutScopeAndAuth() {
+ verifyV31("without-scope-and-auth");
+ }
+ @Test
+ public void verifyInV32WithoutScopeAndAuth() {
+ verifyV32("without-scope-and-auth");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java
index 92ac566b..5cea16f8 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR031ExamplesCheck();
v2Path = getV2Path("examples");
v3Path = getV3Path("examples");
+ v31Path = getV31Path("examples");
+ v32Path = getV32Path("examples");
}
@Test
@@ -40,21 +42,70 @@ public void verifyInV2NestedProperties() {
public void verifyInV3() {
verifyV3("valid.yaml");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid.yaml");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid.yaml");
+ }
@Test
public void verifyInV3WithoutExamples() {
verifyV3("without-examples.yaml");
}
+ @Test
+ public void verifyInV31WithoutExamples() {
+ verifyV31("without-examples.yaml");
+ }
+ @Test
+ public void verifyInV32WithoutExamples() {
+ verifyV32("without-examples.yaml");
+ }
@Test
public void verifyvalidV3ExternalRefs() {
verifyV3("externalref.yaml");
}
+ @Test
+ public void verifyvalidV31ExternalRefs() {
+ verifyV31("externalref.yaml");
+ }
+ @Test
+ public void verifyvalidV32ExternalRefs() {
+ verifyV32("externalref.yaml");
+ }
@Test
public void verifyInV3NestedProperties() {
verifyV3("nested-properties-examples.yaml");
}
+ @Test
+ public void verifyInV31NestedProperties() {
+ verifyV31("nested-properties-examples.yaml");
+ }
+ @Test
+ public void verifyInV32NestedProperties() {
+ verifyV32("nested-properties-examples.yaml");
+ }
+
+ @Test
+ public void verifyInV2AllOfSchema() {
+ verifyV2("allof-schema");
+ }
+ @Test
+ public void verifyInV3AllOfSchema() {
+ verifyV3("allof-schema");
+ }
+ @Test
+ public void verifyInV31AllOfSchema() {
+ verifyV31("allof-schema");
+ }
+ @Test
+ public void verifyInV32AllOfSchema() {
+ verifyV32("allof-schema");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheckTest.java
index 7a3c7438..6d923a60 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR094UseExamplesCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR094UseExamplesCheck();
v2Path = getV2Path("examples");
v3Path = getV3Path("examples");
+ v31Path = getV31Path("examples");
+ v32Path = getV32Path("examples");
}
@Test
@@ -30,16 +32,40 @@ public void verifyvalidV2() {
public void verifyInV3() {
verifyV3("invalid-example");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("invalid-example");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-example");
+ }
@Test
public void verifyvalidV3() {
verifyV3("valid-example");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-example");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-example");
+ }
@Test
public void verifyvalidV3ExternalRefs() {
verifyV3("externalref.yaml");
}
+ @Test
+ public void verifyvalidV31ExternalRefs() {
+ verifyV31("externalref.yaml");
+ }
+ @Test
+ public void verifyvalidV32ExternalRefs() {
+ verifyV32("externalref.yaml");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR006UndefinedRequestMediaTypeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR006UndefinedRequestMediaTypeCheckTest.java
index e65a2e69..6fd54e4b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR006UndefinedRequestMediaTypeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR006UndefinedRequestMediaTypeCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR006UndefinedRequestMediaTypeCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -40,6 +42,14 @@ public void verifyInV2WithoutAnything() {
public void verifyInV3WithoutAnything() {
verifyV3("without-anything");
}
+ @Test
+ public void verifyInV31WithoutAnything() {
+ verifyV31("without-anything");
+ }
+ @Test
+ public void verifyInV32WithoutAnything() {
+ verifyV32("without-anything");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR007UndefinedResponseMediaTypeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR007UndefinedResponseMediaTypeCheckTest.java
index 5f52a3dd..2b4eb51c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR007UndefinedResponseMediaTypeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR007UndefinedResponseMediaTypeCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR007UndefinedResponseMediaTypeCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -40,6 +42,14 @@ public void verifyInV2WithoutAnything() {
public void verifyInV3WithoutAnything() {
verifyV3("without-anything");
}
+ @Test
+ public void verifyInV31WithoutAnything() {
+ verifyV31("without-anything");
+ }
+ @Test
+ public void verifyInV32WithoutAnything() {
+ verifyV32("without-anything");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR009DefaultRequestMediaTypeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR009DefaultRequestMediaTypeCheckTest.java
index a2075757..b42ae90f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR009DefaultRequestMediaTypeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR009DefaultRequestMediaTypeCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR009DefaultRequestMediaTypeCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -51,36 +53,92 @@ public void verifyInV2WithoutAnything() {
public void verifyInV3WithDefault() {
verifyV3("with-default-and-$ref");
}
+ @Test
+ public void verifyInV31WithDefault() {
+ verifyV31("with-default-and-$ref");
+ }
+ @Test
+ public void verifyInV32WithDefault() {
+ verifyV32("with-default-and-$ref");
+ }
@Test
public void verifyInV3WithWrongDefault() {
verifyV3("with-wrong-default");
}
+ @Test
+ public void verifyInV31WithWrongDefault() {
+ verifyV31("with-wrong-default");
+ }
+ @Test
+ public void verifyInV32WithWrongDefault() {
+ verifyV32("with-wrong-default");
+ }
@Test
public void verifyInV3WithSpecific() {
verifyV3("with-specific");
}
+ @Test
+ public void verifyInV31WithSpecific() {
+ verifyV31("with-specific");
+ }
+ @Test
+ public void verifyInV32WithSpecific() {
+ verifyV32("with-specific");
+ }
@Test
public void verifyInV3WithWrongDefaultAndSpecific() {
verifyV3("with-wrong-default-and-specific");
}
+ @Test
+ public void verifyInV31WithWrongDefaultAndSpecific() {
+ verifyV31("with-wrong-default-and-specific");
+ }
+ @Test
+ public void verifyInV32WithWrongDefaultAndSpecific() {
+ verifyV32("with-wrong-default-and-specific");
+ }
@Test
public void verifyInV3WithDefaultAndSpecific() {
verifyV3("with-default-and-specific");
}
+ @Test
+ public void verifyInV31WithDefaultAndSpecific() {
+ verifyV31("with-default-and-specific");
+ }
+ @Test
+ public void verifyInV32WithDefaultAndSpecific() {
+ verifyV32("with-default-and-specific");
+ }
@Test
public void verifyInV3WithoutAnything() {
verifyV3("without-anything");
}
+ @Test
+ public void verifyInV31WithoutAnything() {
+ verifyV31("without-anything");
+ }
+ @Test
+ public void verifyInV32WithoutAnything() {
+ verifyV32("without-anything");
+ }
@Test
public void verifyInV3OperationNotAllowsRequestBody() {
verifyV3("operation-not-allows-request-body");
}
+ @Test
+ public void verifyInV31OperationNotAllowsRequestBody() {
+ verifyV31("operation-not-allows-request-body");
+ }
+ @Test
+ public void verifyInV32OperationNotAllowsRequestBody() {
+ verifyV32("operation-not-allows-request-body");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR010DefaultResponseMediaTypeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR010DefaultResponseMediaTypeCheckTest.java
index e9ed0112..f18c65a5 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR010DefaultResponseMediaTypeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR010DefaultResponseMediaTypeCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR010DefaultResponseMediaTypeCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -51,31 +53,79 @@ public void verifyInV2WithoutAnything() {
public void verifyInV3WithDefault() {
verifyV3("with-default-and-$ref");
}
+ @Test
+ public void verifyInV31WithDefault() {
+ verifyV31("with-default-and-$ref");
+ }
+ @Test
+ public void verifyInV32WithDefault() {
+ verifyV32("with-default-and-$ref");
+ }
@Test
public void verifyInV3WithWrongDefault() {
verifyV3("with-wrong-default");
}
+ @Test
+ public void verifyInV31WithWrongDefault() {
+ verifyV31("with-wrong-default");
+ }
+ @Test
+ public void verifyInV32WithWrongDefault() {
+ verifyV32("with-wrong-default");
+ }
@Test
public void verifyInV3WithSpecific() {
verifyV3("with-specific");
}
+ @Test
+ public void verifyInV31WithSpecific() {
+ verifyV31("with-specific");
+ }
+ @Test
+ public void verifyInV32WithSpecific() {
+ verifyV32("with-specific");
+ }
@Test
public void verifyInV3WithWrongDefaultAndSpecific() {
verifyV3("with-wrong-default-and-specific");
}
+ @Test
+ public void verifyInV31WithWrongDefaultAndSpecific() {
+ verifyV31("with-wrong-default-and-specific");
+ }
+ @Test
+ public void verifyInV32WithWrongDefaultAndSpecific() {
+ verifyV32("with-wrong-default-and-specific");
+ }
@Test
public void verifyInV3WithDefaultAndSpecific() {
verifyV3("with-default-and-specific");
}
+ @Test
+ public void verifyInV31WithDefaultAndSpecific() {
+ verifyV31("with-default-and-specific");
+ }
+ @Test
+ public void verifyInV32WithDefaultAndSpecific() {
+ verifyV32("with-default-and-specific");
+ }
@Test
public void verifyInV3WithoutAnything() {
verifyV3("without-anything");
}
+ @Test
+ public void verifyInV31WithoutAnything() {
+ verifyV31("without-anything");
+ }
+ @Test
+ public void verifyInV32WithoutAnything() {
+ verifyV32("without-anything");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheckTest.java
index ebc51781..71ef8db9 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR011UrlNamingConventionCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR011UrlNamingConventionCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -36,16 +38,40 @@ public void verifyInV2BasePathWrong() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3BasePathOk() {
verifyV3("base-path-ok");
}
+ @Test
+ public void verifyInV31BasePathOk() {
+ verifyV31("base-path-ok");
+ }
+ @Test
+ public void verifyInV32BasePathOk() {
+ verifyV32("base-path-ok");
+ }
@Test
public void verifyInV3BasePathWrong() {
verifyV3("base-path-wrong");
}
+ @Test
+ public void verifyInV31BasePathWrong() {
+ verifyV31("base-path-wrong");
+ }
+ @Test
+ public void verifyInV32BasePathWrong() {
+ verifyV32("base-path-wrong");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheckTest.java
index edeaae0a..70b93b2c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR012ParameterNamingConventionCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR012ParameterNamingConventionCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -44,4 +46,14 @@ public void verifyParameters() {
public void verifyRule() {
assertRuleProperties("OAR012 - ParameterNamingConvention - Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention", RuleType.BUG, Severity.MINOR, tags("format"));
}
+
+ @Test
+ public void verifyCaseInV31() {
+ verifyV31("snake-case-plain");
+ }
+
+ @Test
+ public void verifyCaseInV32() {
+ verifyV32("snake-case-plain");
+ }
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR016NumericFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR016NumericFormatCheckTest.java
index d25802a5..30d0745b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR016NumericFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR016NumericFormatCheckTest.java
@@ -13,6 +13,8 @@ public void init() {
check = new OAR016NumericFormatCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -39,11 +41,27 @@ public void verifyV3() {
public void verifyNestedV3() {
verifyV3("nested");
}
+ @Test
+ public void verifyNestedV31() {
+ verifyV31("nested");
+ }
+ @Test
+ public void verifyNestedV32() {
+ verifyV32("nested");
+ }
@Test
public void verifyWithRefV3() {
verifyV3("with-$ref");
}
+ @Test
+ public void verifyWithRefV31() {
+ verifyV31("with-$ref");
+ }
+ @Test
+ public void verifyWithRefV32() {
+ verifyV32("with-$ref");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java
index a951832e..ad561e9b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR037StringFormatCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -36,21 +38,42 @@ public void verifyInV2WithNested() {
public void verifyInV3() {
verifyV3("complete");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("complete");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("complete");
+ }
@Test
public void verifyInV3WithNested() {
verifyV3("nested");
}
+ @Test
+ public void verifyInV31WithNested() {
+ verifyV31("nested");
+ }
+ @Test
+ public void verifyInV32WithNested() {
+ verifyV32("nested");
+ }
@Test
public void verifyInV3With$ref() {
verifyV3("with-$ref");
}
+ @Test
+ public void verifyInV2BlankFormat() {
+ verifyV2("blank-format");
+ }
+
@Override
public void verifyParameters() {
assertNumberOfParameters(1);
- assertParameterProperties("formats-allowed", "date,date-time,password,byte,binary,email,uuid,uri,hostname,ipv4,ipv6,HEX,HEX(16)", RuleParamType.STRING);
+ assertParameterProperties("formats-allowed", "date,date-time,password,byte,binary,email,uuid,uri,hostname,ipv4,ipv6,HEX,HEX(16),json,xml,base64", RuleParamType.STRING);
}
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR042BasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR042BasePathCheckTest.java
index c2f98370..3dcca42c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR042BasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR042BasePathCheckTest.java
@@ -13,6 +13,8 @@ public void init() {
check = new OAR042BasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -44,16 +46,40 @@ public void verifyV3() {
public void verifyIncorrectVersionV3() {
verifyV3("incorrect-version");
}
+ @Test
+ public void verifyIncorrectVersionV31() {
+ verifyV31("incorrect-version");
+ }
+ @Test
+ public void verifyIncorrectVersionV32() {
+ verifyV32("incorrect-version");
+ }
@Test
public void verifyTooLongV3() {
verifyV3("too-long");
}
+ @Test
+ public void verifyTooLongV31() {
+ verifyV31("too-long");
+ }
+ @Test
+ public void verifyTooLongV32() {
+ verifyV32("too-long");
+ }
@Test
public void verifyTooShortV3() {
verifyV3("too-short");
}
+ @Test
+ public void verifyTooShortV31() {
+ verifyV31("too-short");
+ }
+ @Test
+ public void verifyTooShortV32() {
+ verifyV32("too-short");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheckTest.java
index b991d5ac..ae71be53 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR044MediaTypeCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR044MediaTypeCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("media-type");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("media-type");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("media-type");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheckTest.java
index 1a971af7..851abe03 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR050ProvideOpSummaryCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR050ProvideOpSummaryCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("provide-summary");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("provide-summary");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("provide-summary");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheckTest.java
index 66c7a16b..db1e3326 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR051DescriptionDiffersSummaryCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR051DescriptionDiffersSummaryCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("different-description");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("different-description");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("different-description");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR052UndefinedNumericFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR052UndefinedNumericFormatCheckTest.java
index a7ca363b..a4a650d4 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR052UndefinedNumericFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR052UndefinedNumericFormatCheckTest.java
@@ -13,6 +13,8 @@ public void init() {
check = new OAR052UndefinedNumericFormatCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -37,9 +39,25 @@ public void verifyNestedV3() {
verifyV3("nested");
}
@Test
+ public void verifyNestedV31() {
+ verifyV31("nested");
+ }
+ @Test
+ public void verifyNestedV32() {
+ verifyV32("nested");
+ }
+ @Test
public void verifyWithRefV3() {
verifyV3("with-$ref");
}
+ @Test
+ public void verifyWithRefV31() {
+ verifyV31("with-$ref");
+ }
+ @Test
+ public void verifyWithRefV32() {
+ verifyV32("with-$ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheckTest.java
index 146939cb..4f1d7dc0 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR066SnakeCaseNamingConventionCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR066SnakeCaseNamingConventionCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,9 +32,25 @@ public void verifyInV3() {
verifyV3("snake-case-error");
}
@Test
+ public void verifyInV31() {
+ verifyV31("snake-case-error");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("snake-case-error");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR067CamelCaseNamingConventionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR067CamelCaseNamingConventionCheckTest.java
index d1e20f8e..17bd5caa 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR067CamelCaseNamingConventionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR067CamelCaseNamingConventionCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR067CamelCaseNamingConventionCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,9 +32,25 @@ public void verifyInV3() {
verifyV3("camel-case-error");
}
@Test
+ public void verifyInV31() {
+ verifyV31("camel-case-error");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("camel-case-error");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR068PascalCaseNamingConventionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR068PascalCaseNamingConventionCheckTest.java
index e9c8b1fa..be37e12e 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR068PascalCaseNamingConventionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR068PascalCaseNamingConventionCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR068PascalCaseNamingConventionCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,14 +32,38 @@ public void verifyInV3() {
verifyV3("pascal-case-error");
}
@Test
+ public void verifyInV31() {
+ verifyV31("pascal-case-error");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("pascal-case-error");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyvalidV3ExternalRefs() {
verifyV3("externalref.yaml");
}
+ @Test
+ public void verifyvalidV31ExternalRefs() {
+ verifyV31("externalref.yaml");
+ }
+ @Test
+ public void verifyvalidV32ExternalRefs() {
+ verifyV32("externalref.yaml");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheckTest.java
index b6b57039..c163fd29 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR077ParametersInQuerySnakeCaseCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR077ParametersInQuerySnakeCaseCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,9 +32,25 @@ public void verifyInV3() {
verifyV3("not-valid-in-query");
}
@Test
+ public void verifyInV31() {
+ verifyV31("not-valid-in-query");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("not-valid-in-query");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-in-query");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-in-query");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-in-query");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheckTest.java
index ed60f7fb..e26eefc1 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR086DescriptionFormatCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR086DescriptionFormatCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,19 +32,51 @@ public void verifyInV3() {
verifyV3("invalid-example");
}
@Test
+ public void verifyInV31() {
+ verifyV31("invalid-example");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-example");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-example");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-example");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-example");
+ }
@Test
public void verifyvalidV3internalRef() {
verifyV3("internal-refexample.yaml");
}
+ @Test
+ public void verifyvalidV31internalRef() {
+ verifyV31("internal-refexample.yaml");
+ }
+ @Test
+ public void verifyvalidV32internalRef() {
+ verifyV32("internal-refexample.yaml");
+ }
@Test
public void verifyvalidV3externalRef() {
verifyV3("external-refexample.yaml");
}
+ @Test
+ public void verifyvalidV31externalRef() {
+ verifyV31("external-refexample.yaml");
+ }
+ @Test
+ public void verifyvalidV32externalRef() {
+ verifyV32("external-refexample.yaml");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheckTest.java
index a14318d4..88074751 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR087SummaryFormatCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR087SummaryFormatCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,9 +32,25 @@ public void verifyInV3() {
verifyV3("invalid-example");
}
@Test
+ public void verifyInV31() {
+ verifyV31("invalid-example");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-example");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-example");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-example");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-example");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheckTest.java
index aaf52b9c..4515b5b7 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR088RefParamCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR088RefParamCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -31,9 +33,25 @@ public void verifyInV3() {
verifyV3("invalid-ref");
}
@Test
+ public void verifyInV31() {
+ verifyV31("invalid-ref");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-ref");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-ref");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-ref");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheckTest.java
index 31f787ce..44df8928 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR089RefRequestBodyCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR089RefRequestBodyCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -22,9 +24,25 @@ public void verifyInV3() {
verifyV3("invalid-ref");
}
@Test
+ public void verifyInV31() {
+ verifyV31("invalid-ref");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-ref");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-ref");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-ref");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheckTest.java
index 4bc5b216..1fffe093 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR090RefResponseCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR090RefResponseCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
public void verifyInV2() {
@@ -29,9 +31,25 @@ public void verifyInV3() {
verifyV3("invalid-ref");
}
@Test
+ public void verifyInV31() {
+ verifyV31("invalid-ref");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("invalid-ref");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-ref");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-ref");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR097ShortBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR097ShortBasePathCheckTest.java
index 540c3168..ec3f7176 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR097ShortBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR097ShortBasePathCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR097ShortBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2TooShort() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3TooShort() {
verifyV3("too-short");
}
+ @Test
+ public void verifyInV31TooShort() {
+ verifyV31("too-short");
+ }
+ @Test
+ public void verifyInV32TooShort() {
+ verifyV32("too-short");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR098LongBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR098LongBasePathCheckTest.java
index 2c899df9..ecbe3062 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR098LongBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR098LongBasePathCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR098LongBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2TooLong() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3TooLong() {
verifyV3("too-long");
}
+ @Test
+ public void verifyInV31TooLong() {
+ verifyV31("too-long");
+ }
+ @Test
+ public void verifyInV32TooLong() {
+ verifyV32("too-long");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR099ApiPrefixBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR099ApiPrefixBasePathCheckTest.java
index aa80181b..f919a92e 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR099ApiPrefixBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR099ApiPrefixBasePathCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR099ApiPrefixBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2WithoutApiPrefix() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithoutApiPrefix() {
verifyV3("without-api-prefix");
}
+ @Test
+ public void verifyInV31WithoutApiPrefix() {
+ verifyV31("without-api-prefix");
+ }
+ @Test
+ public void verifyInV32WithoutApiPrefix() {
+ verifyV32("without-api-prefix");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR100LastPartBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR100LastPartBasePathCheckTest.java
index b2c74965..c6aef265 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR100LastPartBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR100LastPartBasePathCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR100LastPartBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2IncorrectVersion() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3IncorrectVersion() {
verifyV3("incorrect-version");
}
+ @Test
+ public void verifyInV31IncorrectVersion() {
+ verifyV31("incorrect-version");
+ }
+ @Test
+ public void verifyInV32IncorrectVersion() {
+ verifyV32("incorrect-version");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR101FirstPartBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR101FirstPartBasePathCheckTest.java
index b1024737..cf38e8ee 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR101FirstPartBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR101FirstPartBasePathCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR101FirstPartBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -35,6 +37,14 @@ public void verifyFirstPartBasePathLogicInV2() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyFirstPartBasePathLogicInV3() {
@@ -44,6 +54,14 @@ public void verifyFirstPartBasePathLogicInV3() {
verifyV3("valid-with-values");
verifyV3("empty-path");
}
+ @Test
+ public void verifyFirstPartBasePathLogicInV31() {
+ verifyV31("empty-path");
+ }
+ @Test
+ public void verifyFirstPartBasePathLogicInV32() {
+ verifyV32("empty-path");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR102SecondPartBasePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR102SecondPartBasePathCheckTest.java
index 481acb92..cfb73eda 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR102SecondPartBasePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR102SecondPartBasePathCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR102SecondPartBasePathCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -35,6 +37,14 @@ public void verifySecondPartBasePathLogicInV2() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifySecondPartBasePathLogicInV3() {
@@ -44,6 +54,14 @@ public void verifySecondPartBasePathLogicInV3() {
verifyV3("valid-with-values");
verifyV3("one-part-path");
}
+ @Test
+ public void verifySecondPartBasePathLogicInV31() {
+ verifyV31("one-part-path");
+ }
+ @Test
+ public void verifySecondPartBasePathLogicInV32() {
+ verifyV32("one-part-path");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR110LicenseInformationCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR110LicenseInformationCheckTest.java
index 2c8a2cbf..3dcbd6d9 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR110LicenseInformationCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR110LicenseInformationCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR110LicenseInformationCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR111ContactInformationCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR111ContactInformationCheckTest.java
index f8902dc7..f25ba899 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR111ContactInformationCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR111ContactInformationCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR111ContactInformationCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheckTest.java
index c0104dd7..cac2d9ac 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR113CustomFieldCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR113CustomFieldCheck();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@@ -31,9 +33,25 @@ public void verifyValidCustomV3() {
verifyV3("valid");
}
@Test
+ public void verifyValidCustomV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyValidCustomV32() {
+ verifyV32("valid");
+ }
+ @Test
public void verifyInvalidCustomV3() {
verifyV3("invalid");
}
+ @Test
+ public void verifyInvalidCustomV31() {
+ verifyV31("invalid");
+ }
+ @Test
+ public void verifyInvalidCustomV32() {
+ verifyV32("invalid");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFieldsTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFieldsTest.java
index 75cfbba4..964b1bbb 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFieldsTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR115VerifyRequiredFieldsTest.java
@@ -13,6 +13,8 @@ public void init() {
check = new OAR115VerifyRequiredFields();
v2Path = getV2Path("format");
v3Path = getV3Path("format");
+ v31Path = getV31Path("format");
+ v32Path = getV32Path("format");
}
@Test
@@ -29,9 +31,25 @@ public void verifyValidRequiredFieldV3() {
verifyV3("valid");
}
@Test
+ public void verifyValidRequiredFieldV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyValidRequiredFieldV32() {
+ verifyV32("valid");
+ }
+ @Test
public void verifyInvalidRequiredFieldV3() {
verifyV3("invalid");
}
+ @Test
+ public void verifyInvalidRequiredFieldV31() {
+ verifyV31("invalid");
+ }
+ @Test
+ public void verifyInvalidRequiredFieldV32() {
+ verifyV32("invalid");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheckTest.java
index 4e130e38..6c2c9c6f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR008AllowedHttpVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR008AllowedHttpVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheckTest.java
index 1ee49572..80d2f8bb 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR013DefaultResponseCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR013DefaultResponseCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheckTest.java
index 3c970b3f..eb641c7d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR014ResourceLevelWithinNonSuggestedRangeCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR014ResourceLevelWithinNonSuggestedRangeCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR015ResourceLevelMaxAllowedCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR015ResourceLevelMaxAllowedCheckTest.java
index c6c62efc..4e5179d9 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR015ResourceLevelMaxAllowedCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR015ResourceLevelMaxAllowedCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR015ResourceLevelMaxAllowedCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java
index 95db735d..88614748 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR017ResourcePathCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,38 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
+
+ @Test
+ public void verifyInV2Resources() {
+ v2Path = getV2Path("resources");
+ verifyV2("plain");
+ }
+
+ @Test
+ public void verifyInV3Resources() {
+ v3Path = getV3Path("resources");
+ verifyV3("plain");
+ }
+
+ @Test
+ public void verifyInV31Resources() {
+ v31Path = getV31Path("resources");
+ verifyV31("plain");
+ }
+
+ @Test
+ public void verifyInV32Resources() {
+ v32Path = getV32Path("resources");
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR018ResourcesByVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR018ResourcesByVerbCheckTest.java
index 4f2bfb4b..566aaa1e 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR018ResourcesByVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR018ResourcesByVerbCheckTest.java
@@ -17,6 +17,8 @@ public void init() {
check = new OAR018ResourcesByVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@@ -28,6 +30,14 @@ public void verifyInV2(){
public void verifyInV3(){
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheckTest.java
index fd61b5e7..a6e54eda 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR027PostResponseLocationHeaderCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR027PostResponseLocationHeaderCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -45,26 +47,66 @@ public void verifyInV2Post201WithLocation() {
public void verifyInV3NoPost() {
verifyV3("no-post");
}
+ @Test
+ public void verifyInV31NoPost() {
+ verifyV31("no-post");
+ }
+ @Test
+ public void verifyInV32NoPost() {
+ verifyV32("no-post");
+ }
@Test
public void verifyInV3PostNo201() {
verifyV3("post-no-201");
}
+ @Test
+ public void verifyInV31PostNo201() {
+ verifyV31("post-no-201");
+ }
+ @Test
+ public void verifyInV32PostNo201() {
+ verifyV32("post-no-201");
+ }
@Test
public void verifyInV3Post201WithoutLocation() {
verifyV3("post-201-without-location");
}
+ @Test
+ public void verifyInV31Post201WithoutLocation() {
+ verifyV31("post-201-without-location");
+ }
+ @Test
+ public void verifyInV32Post201WithoutLocation() {
+ verifyV32("post-201-without-location");
+ }
@Test
public void verifyInV3Post201WithOtherHeaders() {
verifyV3("post-201-with-other-headers");
}
+ @Test
+ public void verifyInV31Post201WithOtherHeaders() {
+ verifyV31("post-201-with-other-headers");
+ }
+ @Test
+ public void verifyInV32Post201WithOtherHeaders() {
+ verifyV32("post-201-with-other-headers");
+ }
@Test
public void verifyInV3Post201WithLocation() {
verifyV3("post-201-with-location");
}
+ @Test
+ public void verifyInV31Post201WithLocation() {
+ verifyV31("post-201-with-location");
+ }
+ @Test
+ public void verifyInV32Post201WithLocation() {
+ verifyV32("post-201-with-location");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheckTest.java
index 999b0822..f1249565 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR030StatusEndpointCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR030StatusEndpointCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -36,16 +38,40 @@ public void verifyInV2WithStatusWithoutGet() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithoutStatus() {
verifyV3("without-status");
}
+ @Test
+ public void verifyInV31WithoutStatus() {
+ verifyV31("without-status");
+ }
+ @Test
+ public void verifyInV32WithoutStatus() {
+ verifyV32("without-status");
+ }
@Test
public void verifyInV3WithStatusWithoutGet() {
verifyV3("with-status-without-get");
}
+ @Test
+ public void verifyInV31WithStatusWithoutGet() {
+ verifyV31("with-status-without-get");
+ }
+ @Test
+ public void verifyInV32WithStatusWithoutGet() {
+ verifyV32("with-status-without-get");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheckTest.java
index 7e6d0646..caf35009 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR032AmbiguousElementsPathCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR032AmbiguousElementsPathCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2WithForbiddenNames() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithForbiddenNames() {
verifyV3("forbidden-names");
}
+ @Test
+ public void verifyInV31WithForbiddenNames() {
+ verifyV31("forbidden-names");
+ }
+ @Test
+ public void verifyInV32WithForbiddenNames() {
+ verifyV32("forbidden-names");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheckTest.java
index 6411df68..b637b138 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR038StandardCreateResponseCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR038StandardCreateResponseCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -51,31 +53,113 @@ public void verifyInV2WithoutSchema() {
public void verifyInV3WithOneProperty() {
verifyV3("valid-one-property");
}
+ @Test
+ public void verifyInV31WithOneProperty() {
+ verifyV31("valid-one-property");
+ }
+ @Test
+ public void verifyInV32WithOneProperty() {
+ verifyV32("valid-one-property");
+ }
@Test
public void verifyInV3WithMultipleProperties() {
verifyV3("valid-multiple-properties");
}
+ @Test
+ public void verifyInV31WithMultipleProperties() {
+ verifyV31("valid-multiple-properties");
+ }
+ @Test
+ public void verifyInV32WithMultipleProperties() {
+ verifyV32("valid-multiple-properties");
+ }
@Test
public void verifyInV3WithoutProperties() {
verifyV3("without-properties");
}
+ @Test
+ public void verifyInV31WithoutProperties() {
+ verifyV31("without-properties");
+ }
+ @Test
+ public void verifyInV32WithoutProperties() {
+ verifyV32("without-properties");
+ }
@Test
public void verifyInV3WithPropertiesEmpty() {
verifyV3("with-properties-empty");
}
+ @Test
+ public void verifyInV31WithPropertiesEmpty() {
+ verifyV31("with-properties-empty");
+ }
+ @Test
+ public void verifyInV32WithPropertiesEmpty() {
+ verifyV32("with-properties-empty");
+ }
@Test
public void verifyInV3WithoutData() {
verifyV3("without-data");
}
+ @Test
+ public void verifyInV31WithoutData() {
+ verifyV31("without-data");
+ }
+ @Test
+ public void verifyInV32WithoutData() {
+ verifyV32("without-data");
+ }
@Test
public void verifyInV3WithoutSchema() {
verifyV3("without-schema");
}
+ @Test
+ public void verifyInV31WithoutSchema() {
+ verifyV31("without-schema");
+ }
+ @Test
+ public void verifyInV32WithoutSchema() {
+ verifyV32("without-schema");
+ }
+
+ @Test
+ public void verifyInV2WithErrorProperty() {
+ verifyV2("valid-with-error");
+ }
+ @Test
+ public void verifyInV3WithErrorProperty() {
+ verifyV3("valid-with-error");
+ }
+ @Test
+ public void verifyInV31WithErrorProperty() {
+ verifyV31("valid-with-error");
+ }
+ @Test
+ public void verifyInV32WithErrorProperty() {
+ verifyV32("valid-with-error");
+ }
+
+ @Test
+ public void verifyInV2WithInvalidProperty() {
+ verifyV2("with-invalid-property");
+ }
+ @Test
+ public void verifyInV3WithInvalidProperty() {
+ verifyV3("with-invalid-property");
+ }
+ @Test
+ public void verifyInV31WithInvalidProperty() {
+ verifyV31("with-invalid-property");
+ }
+ @Test
+ public void verifyInV32WithInvalidProperty() {
+ verifyV32("with-invalid-property");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR039StandardResponseCodesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR039StandardResponseCodesCheckTest.java
index 98f833b9..028c498d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR039StandardResponseCodesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR039StandardResponseCodesCheckTest.java
@@ -19,6 +19,8 @@ public void init() {
check = new OAR039StandardResponseCodesCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@@ -36,9 +38,25 @@ public void verifyInV3(){
verifyV3("valid");
}
@Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
+ @Test
public void verifyMissingCodesV3(){
verifyV3("missing-codes");
}
+ @Test
+ public void verifyMissingCodesV31() {
+ verifyV31("missing-codes");
+ }
+ @Test
+ public void verifyMissingCodesV32() {
+ verifyV32("missing-codes");
+ }
@Override
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheckTest.java
index 5b9eafb6..86ba30f4 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR046DeclaredTagCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR046DeclaredTagCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("declared-tag");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("declared-tag");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("declared-tag");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheckTest.java
index aae75be4..aba52449 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR047DocumentedTagCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR047DocumentedTagCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR048AtMostOneBodyParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR048AtMostOneBodyParameterCheckTest.java
index 1215e575..880ce889 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR048AtMostOneBodyParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR048AtMostOneBodyParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR048AtMostOneBodyParameterCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR061GetMethodCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR061GetMethodCheckTest.java
index eb7d2c1b..4fa46f72 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR061GetMethodCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR061GetMethodCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR061GetMethodCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2InsufficentResponseCodes() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3InsufficentResponseCodes() {
verifyV3("insuficent-response-codes");
}
+ @Test
+ public void verifyInV31InsufficentResponseCodes() {
+ verifyV31("insuficent-response-codes");
+ }
+ @Test
+ public void verifyInV32InsufficentResponseCodes() {
+ verifyV32("insuficent-response-codes");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR062PostMethodCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR062PostMethodCheckTest.java
index c3d1a8b5..862bd483 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR062PostMethodCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR062PostMethodCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR062PostMethodCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2InsufficentResponseCodes() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3InsufficentResponseCodes() {
verifyV3("insuficent-response-codes");
}
+ @Test
+ public void verifyInV31InsufficentResponseCodes() {
+ verifyV31("insuficent-response-codes");
+ }
+ @Test
+ public void verifyInV32InsufficentResponseCodes() {
+ verifyV32("insuficent-response-codes");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR063PutMethodCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR063PutMethodCheckTest.java
index a0387f15..4cf33392 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR063PutMethodCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR063PutMethodCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR063PutMethodCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2InsufficentResponseCodes() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3InsufficentResponseCodes() {
verifyV3("insuficent-response-codes");
}
+ @Test
+ public void verifyInV31InsufficentResponseCodes() {
+ verifyV31("insuficent-response-codes");
+ }
+ @Test
+ public void verifyInV32InsufficentResponseCodes() {
+ verifyV32("insuficent-response-codes");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR064PatchMethodCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR064PatchMethodCheckTest.java
index 9df783e6..3c60317f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR064PatchMethodCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR064PatchMethodCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR064PatchMethodCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2InsufficentResponseCodes() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3InsufficentResponseCodes() {
verifyV3("insuficent-response-codes");
}
+ @Test
+ public void verifyInV31InsufficentResponseCodes() {
+ verifyV31("insuficent-response-codes");
+ }
+ @Test
+ public void verifyInV32InsufficentResponseCodes() {
+ verifyV32("insuficent-response-codes");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR065DeleteMethodCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR065DeleteMethodCheckTest.java
index 4005f3b7..6a4c3190 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR065DeleteMethodCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR065DeleteMethodCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR065DeleteMethodCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2InsufficentResponseCodes() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3InsufficentResponseCodes() {
verifyV3("insuficent-response-codes");
}
+ @Test
+ public void verifyInV31InsufficentResponseCodes() {
+ verifyV31("insuficent-response-codes");
+ }
+ @Test
+ public void verifyInV32InsufficentResponseCodes() {
+ verifyV32("insuficent-response-codes");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheckTest.java
index 9ac755d7..8df34511 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR071GetQueryParamsDefinedCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR071GetQueryParamsDefinedCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2MissingQueryParams() {
public void verifyInV3() {
verifyV3("valid-query-params");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid-query-params");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid-query-params");
+ }
@Test
public void verifyInV3MissingQueryParams() {
verifyV3("missing-query-params");
}
+ @Test
+ public void verifyInV31MissingQueryParams() {
+ verifyV31("missing-query-params");
+ }
+ @Test
+ public void verifyInV32MissingQueryParams() {
+ verifyV32("missing-query-params");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheckTest.java
index d6f578d8..e15ff7e2 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR091ParamOnlyRefCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR091ParamOnlyRefCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2withref() {
public void verifyInV3noref() {
verifyV3("no-ref");
}
+ @Test
+ public void verifyInV31noref() {
+ verifyV31("no-ref");
+ }
+ @Test
+ public void verifyInV32noref() {
+ verifyV32("no-ref");
+ }
@Test
public void verifyInV3withref() {
verifyV3("with-ref");
}
+ @Test
+ public void verifyInV31withref() {
+ verifyV31("with-ref");
+ }
+ @Test
+ public void verifyInV32withref() {
+ verifyV32("with-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheckTest.java
index 77dd8d4d..5f74674d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR092RequestBodyOnlyRefCheckTest.java
@@ -14,16 +14,34 @@ public void init() {
check = new OAR092RequestBodyOnlyRefCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
public void verifyInV3noref() {
verifyV3("no-ref");
}
+ @Test
+ public void verifyInV31noref() {
+ verifyV31("no-ref");
+ }
+ @Test
+ public void verifyInV32noref() {
+ verifyV32("no-ref");
+ }
@Test
public void verifyInV3withref() {
verifyV3("with-ref");
}
+ @Test
+ public void verifyInV31withref() {
+ verifyV31("with-ref");
+ }
+ @Test
+ public void verifyInV32withref() {
+ verifyV32("with-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheckTest.java
index f448dfe4..8cdd56f5 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR093ResponseOnlyRefCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR093ResponseOnlyRefCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2withref() {
public void verifyInV3noref() {
verifyV3("no-ref");
}
+ @Test
+ public void verifyInV31noref() {
+ verifyV31("no-ref");
+ }
+ @Test
+ public void verifyInV32noref() {
+ verifyV32("no-ref");
+ }
@Test
public void verifyInV3withref() {
verifyV3("with-ref");
}
+ @Test
+ public void verifyInV31withref() {
+ verifyV31("with-ref");
+ }
+ @Test
+ public void verifyInV32withref() {
+ verifyV32("with-ref");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR103ResourcesByGetVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR103ResourcesByGetVerbCheckTest.java
index 021538cc..cf039503 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR103ResourcesByGetVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR103ResourcesByGetVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR103ResourcesByGetVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR104ResourcesByPostVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR104ResourcesByPostVerbCheckTest.java
index ec981f9c..030e2a92 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR104ResourcesByPostVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR104ResourcesByPostVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR104ResourcesByPostVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain.yaml");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain.yaml");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain.yaml");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR105ResourcesByPutVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR105ResourcesByPutVerbCheckTest.java
index fcbc8bdc..358f5a95 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR105ResourcesByPutVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR105ResourcesByPutVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR105ResourcesByPutVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR106ResourcesByPatchVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR106ResourcesByPatchVerbCheckTest.java
index fa5dde1b..eb30fa43 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR106ResourcesByPatchVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR106ResourcesByPatchVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR106ResourcesByPatchVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR107ResourcesByDeleteVerbCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR107ResourcesByDeleteVerbCheckTest.java
index c54fc046..1b80ed58 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR107ResourcesByDeleteVerbCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR107ResourcesByDeleteVerbCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR107ResourcesByDeleteVerbCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheckTest.java
index 32e99855..2602892b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR109ForbiddenInternalServerErrorCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR109ForbiddenInternalServerErrorCheck();
v2Path = getV2Path("operations");
v3Path = getV3Path("operations");
+ v31Path = getV31Path("operations");
+ v32Path = getV32Path("operations");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR070BrokenAccessControlCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR070BrokenAccessControlCheckTest.java
index 5e16db2c..94a09031 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR070BrokenAccessControlCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR070BrokenAccessControlCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR070BrokenAccessControlCheck();
v2Path = getV2Path("owasp");
v3Path = getV3Path("owasp");
+ v31Path = getV31Path("owasp");
+ v32Path = getV32Path("owasp");
}
@Test
@@ -29,9 +31,25 @@ public void verifyInV3numeric() {
verifyV3("numeric");
}
@Test
+ public void verifyInV31numeric() {
+ verifyV31("numeric");
+ }
+ @Test
+ public void verifyInV32numeric() {
+ verifyV32("numeric");
+ }
+ @Test
public void verifyInV3noNumeric() {
verifyV3("no-numeric");
}
+ @Test
+ public void verifyInV31noNumeric() {
+ verifyV31("no-numeric");
+ }
+ @Test
+ public void verifyInV32noNumeric() {
+ verifyV32("no-numeric");
+ }
@Override
public void verifyRule() {
assertRuleProperties("OAR070 - BrokenAccessControl - Parameters in path shouldn't be numeric", RuleType.VULNERABILITY, Severity.MAJOR, tags("owasp"));
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheckTest.java
index 0d9d672b..8a9abd94 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/owasp/OAR073RateLimitCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR073RateLimitCheck();
v2Path = getV2Path("owasp");
v3Path = getV3Path("owasp");
+ v31Path = getV31Path("owasp");
+ v32Path = getV32Path("owasp");
}
@Test
@@ -27,15 +29,51 @@ public void verifyInV2NorateLimit() {
verifyV2("no-rate-limit");
}
+ @Test
+ public void verifyInV2HealthCheckExcluded() {
+ verifyV2("health-check-excluded");
+ }
+
@Test
public void verifyInV3rateLimit() {
verifyV3("rate-limit");
}
+ @Test
+ public void verifyInV31rateLimit() {
+ verifyV31("rate-limit");
+ }
+ @Test
+ public void verifyInV32rateLimit() {
+ verifyV32("rate-limit");
+ }
@Test
public void verifyInV3NorateLimit() {
verifyV3("no-rate-limit");
}
+ @Test
+ public void verifyInV31NorateLimit() {
+ verifyV31("no-rate-limit");
+ }
+ @Test
+ public void verifyInV32NorateLimit() {
+ verifyV32("no-rate-limit");
+ }
+
+ @Test
+ public void verifyInV3HealthCheckExcluded() {
+ verifyV3("health-check-excluded");
+ }
+
+ @Test
+ public void verifyInV31HealthCheckExcluded() {
+ verifyV31("health-check-excluded");
+ }
+
+ @Test
+ public void verifyInV32HealthCheckExcluded() {
+ verifyV32("health-check-excluded");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java
index 4c6f5fac..49359130 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java
@@ -16,6 +16,8 @@ public void init() {
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
+ v31Path = getV31Path("parameters");
}
@Test
@@ -47,46 +49,66 @@ public void verifyInV2PathEndingWithParam() {
public void verifyInV3() {
verifyV3("plain");
}
-
- @Test
- public void verifyInV3Excluded() {
- verifyV3("excluded");
- }
-
@Test
- public void verifyInV3Without() {
- verifyV3("plain-without");
+ public void verifyInV31() {
+ verifyV31("plain");
}
-
@Test
- public void verifyInV3WithRef() {
- verifyV3("with-ref");
+ public void verifyInV32() {
+ verifyV32("plain");
}
@Test
- public void verifyInV31() {
- verifyV31("plain");
+ public void verifyInV3Excluded() {
+ verifyV3("excluded");
}
-
@Test
public void verifyInV31Excluded() {
verifyV31("excluded");
}
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
+ @Test
+ public void verifyInV3Without() {
+ verifyV3("plain-without");
+ }
@Test
public void verifyInV31Without() {
verifyV31("plain-without");
}
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
+ @Test
+ public void verifyInV3WithRef() {
+ verifyV3("with-ref");
+ }
@Test
public void verifyInV31WithRef() {
verifyV31("with-ref");
}
+ @Test
+ public void verifyInV32WithRef() {
+ verifyV32("with-ref");
+ }
@Test
public void verifyInV3PathEndingWithParam() {
verifyV3("with-param");
}
+ @Test
+ public void verifyInV31PathEndingWithParam() {
+ verifyV31("with-param");
+ }
+ @Test
+ public void verifyInV32PathEndingWithParam() {
+ verifyV32("with-param");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java
index 47efc473..ceea3c8f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR020ExpandParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -46,26 +48,100 @@ public void verifyInV2PathEndingWithParam() {
public void verifyInV3() {
verifyV3("plain2");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain2");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain2");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded2");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded2");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded2");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without2");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without2");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without2");
+ }
@Test
public void verifyInV3WithRef() {
verifyV3("with-ref");
}
+ @Test
+ public void verifyInV31WithRef() {
+ verifyV31("with-ref");
+ }
+ @Test
+ public void verifyInV32WithRef() {
+ verifyV32("with-ref");
+ }
@Test
public void verifyInV3PathEndingWithParam() {
verifyV3("with-param");
}
+ @Test
+ public void verifyInV31PathEndingWithParam() {
+ verifyV31("with-param");
+ }
+ @Test
+ public void verifyInV32PathEndingWithParam() {
+ verifyV32("with-param");
+ }
+
+ @Test
+ public void verifyInV2ExpandNoDollar() {
+ verifyV2("expand-no-dollar");
+ }
+ @Test
+ public void verifyInV3ExpandNoDollar() {
+ verifyV3("expand-no-dollar");
+ }
+ @Test
+ public void verifyInV31ExpandNoDollar() {
+ verifyV31("expand-no-dollar");
+ }
+ @Test
+ public void verifyInV32ExpandNoDollar() {
+ verifyV32("expand-no-dollar");
+ }
+
+ @Test
+ public void verifyInV2WithoutParameters() {
+ verifyV2("without-parameters");
+ }
+ @Test
+ public void verifyInV3WithoutParameters() {
+ verifyV3("without-parameters");
+ }
+ @Test
+ public void verifyInV31WithoutParameters() {
+ verifyV31("without-parameters");
+ }
+ @Test
+ public void verifyInV32WithoutParameters() {
+ verifyV32("without-parameters");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java
index 120b0834..6cce39f9 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR021ExcludeParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -46,26 +48,100 @@ public void verifyInV2PathEndingWithParam() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Test
public void verifyInV3WithRef() {
verifyV3("with-ref");
}
+ @Test
+ public void verifyInV31WithRef() {
+ verifyV31("with-ref");
+ }
+ @Test
+ public void verifyInV32WithRef() {
+ verifyV32("with-ref");
+ }
@Test
public void verifyInV3PathEndingWithParam() {
verifyV3("with-param");
}
+ @Test
+ public void verifyInV31PathEndingWithParam() {
+ verifyV31("with-param");
+ }
+ @Test
+ public void verifyInV32PathEndingWithParam() {
+ verifyV32("with-param");
+ }
+
+ @Test
+ public void verifyInV2ExcludeNoDollar() {
+ verifyV2("exclude-no-dollar");
+ }
+ @Test
+ public void verifyInV3ExcludeNoDollar() {
+ verifyV3("exclude-no-dollar");
+ }
+ @Test
+ public void verifyInV31ExcludeNoDollar() {
+ verifyV31("exclude-no-dollar");
+ }
+ @Test
+ public void verifyInV32ExcludeNoDollar() {
+ verifyV32("exclude-no-dollar");
+ }
+
+ @Test
+ public void verifyInV2WithoutParameters() {
+ verifyV2("without-parameters");
+ }
+ @Test
+ public void verifyInV3WithoutParameters() {
+ verifyV3("without-parameters");
+ }
+ @Test
+ public void verifyInV31WithoutParameters() {
+ verifyV31("without-parameters");
+ }
+ @Test
+ public void verifyInV32WithoutParameters() {
+ verifyV32("without-parameters");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java
index 126f7c9f..e7fccdb3 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR022OrderbyParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2Without() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR023TotalParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR023TotalParameterCheckTest.java
index 27a5f10d..20c0f437 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR023TotalParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR023TotalParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR023TotalParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2Without() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR024StartParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR024StartParameterCheckTest.java
index d9b2be01..a619608b 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR024StartParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR024StartParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR024StartParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2Without() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java
index b3cbc022..e6562b9d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR025LimitParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -35,16 +37,40 @@ public void verifyInV2Without() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheckTest.java
index b4f195ac..c1c619a2 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR026TotalParameterDefaultValueCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR026TotalParameterDefaultValueCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -105,6 +107,14 @@ public void verifyInV2WithoutParameters() {
public void verifyInV3WithoutParameters() {
verifyV3("without-parameters");
}
+ @Test
+ public void verifyInV31WithoutParameters() {
+ verifyV31("without-parameters");
+ }
+ @Test
+ public void verifyInV32WithoutParameters() {
+ verifyV32("without-parameters");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheckTest.java
index 765481d6..e2d9350f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR028FilterParameterCheckTest.java
@@ -27,6 +27,8 @@ public void init() {
check = new OAR028FilterParameterCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -47,16 +49,40 @@ public void verifyInV2Without() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3Excluded() {
verifyV3("excluded");
}
+ @Test
+ public void verifyInV31Excluded() {
+ verifyV31("excluded");
+ }
+ @Test
+ public void verifyInV32Excluded() {
+ verifyV32("excluded");
+ }
@Test
public void verifyInV3Without() {
verifyV3("plain-without");
}
+ @Test
+ public void verifyInV31Without() {
+ verifyV31("plain-without");
+ }
+ @Test
+ public void verifyInV32Without() {
+ verifyV32("plain-without");
+ }
@Test
public void verifyInV2ExcludeStrategy() {
@@ -71,6 +97,18 @@ public void verifyInV3ExcludeStrategy() {
setField("pathsStr", "/examples");
verifyV3("exclude-noncompliant");
}
+ @Test
+ public void verifyInV31ExcludeStrategy() {
+ setField("pathCheckStrategy", "/exclude");
+ setField("pathsStr", "/examples");
+ verifyV31("exclude-noncompliant");
+ }
+ @Test
+ public void verifyInV32ExcludeStrategy() {
+ setField("pathCheckStrategy", "/exclude");
+ setField("pathsStr", "/examples");
+ verifyV32("exclude-noncompliant");
+ }
@Test
public void verifyInV2EmptyPaths() {
@@ -83,15 +121,74 @@ public void verifyInV3EmptyPaths() {
setField("pathsStr", "");
verifyV3("plain");
}
+ @Test
+ public void verifyInV31EmptyPaths() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32EmptyPaths() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3ComponentsParam() {
verifyV3("components-param");
}
+ @Test
+ public void verifyInV31ComponentsParam() {
+ verifyV31("components-param");
+ }
+ @Test
+ public void verifyInV32ComponentsParam() {
+ verifyV32("components-param");
+ }
+
+ @Test
+ public void verifyInV2HeaderIgnored() {
+ verifyV2("header-ignored");
+ }
+ @Test
+ public void verifyInV3HeaderIgnored() {
+ verifyV3("header-ignored");
+ }
+ @Test
+ public void verifyInV31HeaderIgnored() {
+ verifyV31("header-ignored");
+ }
+ @Test
+ public void verifyInV32HeaderIgnored() {
+ verifyV32("header-ignored");
+ }
+
+ @Test
+ public void verifyInV2MeHealthPing() {
+ verifyV2("me-health-ping");
+ }
+ @Test
+ public void verifyInV3MeHealthPing() {
+ verifyV3("me-health-ping");
+ }
+ @Test
+ public void verifyInV31MeHealthPing() {
+ verifyV31("me-health-ping");
+ }
+ @Test
+ public void verifyInV32MeHealthPing() {
+ verifyV32("me-health-ping");
+ }
private void setField(String name, String value) {
try {
- java.lang.reflect.Field f = OAR028FilterParameterCheck.class.getDeclaredField(name);
+ java.lang.reflect.Field f = null;
+ Class> clazz = check.getClass();
+ while (clazz != null && f == null) {
+ try {
+ f = clazz.getDeclaredField(name);
+ } catch (NoSuchFieldException e) {
+ clazz = clazz.getSuperclass();
+ }
+ }
+ if (f == null) throw new NoSuchFieldException(name);
f.setAccessible(true);
f.set(check, value);
} catch (Exception e) {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR060QueryParametersOptionalCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR060QueryParametersOptionalCheckTest.java
index 480c0641..e9058dbb 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR060QueryParametersOptionalCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR060QueryParametersOptionalCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR060QueryParametersOptionalCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -29,9 +31,25 @@ public void verifyInV3requiredFalse() {
verifyV3("required-false");
}
@Test
+ public void verifyInV31requiredFalse() {
+ verifyV31("required-false");
+ }
+ @Test
+ public void verifyInV32requiredFalse() {
+ verifyV32("required-false");
+ }
+ @Test
public void verifyInV3requiredTrue() {
verifyV3("required-true");
}
+ @Test
+ public void verifyInV31requiredTrue() {
+ verifyV31("required-true");
+ }
+ @Test
+ public void verifyInV32requiredTrue() {
+ verifyV32("required-true");
+ }
@Override
public void verifyRule() {
assertRuleProperties("OAR060 - QueryParametersOptional - All parameters in query must be defined as optional", RuleType.BUG, Severity.CRITICAL, tags("parameters"));
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheckTest.java
index a4b8c2f5..522343a8 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR069PathParamAndQueryCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR069PathParamAndQueryCheck();
v2Path = getV2Path("parameters");
v3Path = getV3Path("parameters");
+ v31Path = getV31Path("parameters");
+ v32Path = getV32Path("parameters");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2NoBadRequest() {
public void verifyInV3BadRequest() {
verifyV3("bad-request400");
}
+ @Test
+ public void verifyInV31BadRequest() {
+ verifyV31("bad-request400");
+ }
+ @Test
+ public void verifyInV32BadRequest() {
+ verifyV32("bad-request400");
+ }
@Test
public void verifyInV3NoBadRequest() {
verifyV3("no-bad-request400");
}
+ @Test
+ public void verifyInV31NoBadRequest() {
+ verifyV31("no-bad-request400");
+ }
+ @Test
+ public void verifyInV32NoBadRequest() {
+ verifyV32("no-bad-request400");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheckTest.java
index 924a317e..58533ad5 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/regex/OAR112RegexCheckTest.java
@@ -17,6 +17,8 @@ public void init() {
check = new OAR112RegexCheck();
v2Path = getV2Path("regex");
v3Path = getV3Path("regex");
+ v31Path = getV31Path("regex");
+ v32Path = getV32Path("regex");
}
private void setField(String fieldName, String value) {
@@ -38,6 +40,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInfoDescriptionInvalidInV2() {
@@ -48,30 +58,74 @@ public void verifyInfoDescriptionInvalidInV2() {
public void verifyInfoDescriptionInvalidInV3() {
verifyV3("info-invalid");
}
+ @Test
+ public void verifyInfoDescriptionInvalidInV31() {
+ verifyV31("info-invalid");
+ }
+ @Test
+ public void verifyInfoDescriptionInvalidInV32() {
+ verifyV32("info-invalid");
+ }
@Test
public void verifyServersDescriptionValidInV3() {
setField("nodes", "servers/description");
verifyV3("servers-valid");
}
+ @Test
+ public void verifyServersDescriptionValidInV31() {
+ verifyV31("servers-valid");
+ }
+ @Test
+ public void verifyServersDescriptionValidInV32() {
+ verifyV32("servers-valid");
+ }
@Test
public void verifyServersDescriptionInvalidInV3() {
setField("nodes", "servers/description");
verifyV3("servers-invalid");
}
+ @Test
+ public void verifyServersDescriptionInvalidInV31() {
+ setField("nodes", "servers/description");
+ verifyV31("servers-invalid");
+ }
+ @Test
+ public void verifyServersDescriptionInvalidInV32() {
+ setField("nodes", "servers/description");
+ verifyV32("servers-invalid");
+ }
@Test
public void verifyOperationSummaryValidInV3() {
setField("nodes", "paths/get/summary");
verifyV3("operation-valid");
}
+ @Test
+ public void verifyOperationSummaryValidInV31() {
+ verifyV31("operation-valid");
+ }
+ @Test
+ public void verifyOperationSummaryValidInV32() {
+ verifyV32("operation-valid");
+ }
@Test
public void verifyOperationSummaryInvalidInV3() {
setField("nodes", "paths/get/summary");
verifyV3("operation-invalid");
}
+ @Test
+ public void verifyOperationSummaryInvalidInV31() {
+ setField("nodes", "paths/get/summary");
+ verifyV31("operation-invalid");
+ }
+ @Test
+ public void verifyOperationSummaryInvalidInV32() {
+ setField("nodes", "paths/get/summary");
+ verifyV32("operation-invalid");
+ }
@Test
public void verifyOperationSummaryValidInV2() {
@@ -90,12 +144,30 @@ public void verifyTagsNameValidInV3() {
setField("nodes", "tags/name");
verifyV3("tags-valid");
}
+ @Test
+ public void verifyTagsNameValidInV31() {
+ verifyV31("tags-valid");
+ }
+ @Test
+ public void verifyTagsNameValidInV32() {
+ verifyV32("tags-valid");
+ }
@Test
public void verifyTagsNameInvalidInV3() {
setField("nodes", "tags/name");
verifyV3("tags-invalid");
}
+ @Test
+ public void verifyTagsNameInvalidInV31() {
+ setField("nodes", "tags/name");
+ verifyV31("tags-invalid");
+ }
+ @Test
+ public void verifyTagsNameInvalidInV32() {
+ setField("nodes", "tags/name");
+ verifyV32("tags-invalid");
+ }
@Test
public void verifyTagsNameValidInV2() {
@@ -114,12 +186,30 @@ public void verifyExternalDocsDescriptionValidInV3() {
setField("nodes", "externalDocs/description");
verifyV3("external-docs-valid");
}
+ @Test
+ public void verifyExternalDocsDescriptionValidInV31() {
+ verifyV31("external-docs-valid");
+ }
+ @Test
+ public void verifyExternalDocsDescriptionValidInV32() {
+ verifyV32("external-docs-valid");
+ }
@Test
public void verifyExternalDocsDescriptionInvalidInV3() {
setField("nodes", "externalDocs/description");
verifyV3("external-docs-invalid");
}
+ @Test
+ public void verifyExternalDocsDescriptionInvalidInV31() {
+ setField("nodes", "externalDocs/description");
+ verifyV31("external-docs-invalid");
+ }
+ @Test
+ public void verifyExternalDocsDescriptionInvalidInV32() {
+ setField("nodes", "externalDocs/description");
+ verifyV32("external-docs-invalid");
+ }
@Test
public void verifyExternalDocsDescriptionValidInV2() {
@@ -138,12 +228,30 @@ public void verifyParametersDescriptionValidInV3() {
setField("nodes", "paths/get/parameters/description");
verifyV3("parameters-valid");
}
+ @Test
+ public void verifyParametersDescriptionValidInV31() {
+ verifyV31("parameters-valid");
+ }
+ @Test
+ public void verifyParametersDescriptionValidInV32() {
+ verifyV32("parameters-valid");
+ }
@Test
public void verifyParametersDescriptionInvalidInV3() {
setField("nodes", "paths/get/parameters/description");
verifyV3("parameters-invalid");
}
+ @Test
+ public void verifyParametersDescriptionInvalidInV31() {
+ setField("nodes", "paths/get/parameters/description");
+ verifyV31("parameters-invalid");
+ }
+ @Test
+ public void verifyParametersDescriptionInvalidInV32() {
+ setField("nodes", "paths/get/parameters/description");
+ verifyV32("parameters-invalid");
+ }
@Test
public void verifyBooleanTrueMissingFieldInV3() {
@@ -155,6 +263,14 @@ public void verifyBooleanTrueMissingFieldInV3() {
verifyV3("info-invalid");
verifyV3("minimal");
}
+ @Test
+ public void verifyBooleanTrueMissingFieldInV31() {
+ verifyV31("minimal");
+ }
+ @Test
+ public void verifyBooleanTrueMissingFieldInV32() {
+ verifyV32("minimal");
+ }
@Test
public void verifyBooleanTrueMissingFieldInV2() {
@@ -173,6 +289,14 @@ public void verifyBooleanFalseFieldPresentInV3() {
setField("valid", "false");
verifyV3("info-invalid");
}
+ @Test
+ public void verifyBooleanFalseFieldPresentInV31() {
+ verifyV31("info-invalid");
+ }
+ @Test
+ public void verifyBooleanFalseFieldPresentInV32() {
+ verifyV32("info-invalid");
+ }
@Test
public void verifyBooleanFalseFieldPresentInV2() {
@@ -187,6 +311,14 @@ public void verifyBooleanFalseFieldAbsentInV3() {
setField("valid", "false");
verifyV3("minimal");
}
+ @Test
+ public void verifyBooleanFalseFieldAbsentInV31() {
+ verifyV31("minimal");
+ }
+ @Test
+ public void verifyBooleanFalseFieldAbsentInV32() {
+ verifyV32("minimal");
+ }
@Test
public void verifyBooleanFalseFieldAbsentInV2() {
@@ -207,4 +339,4 @@ public void verifyParameters() {
assertParameterProperties("Error Message", "The field must start with an uppercase letter.", RuleParamType.STRING);
assertParameterProperties("Validation", "^[A-Z].*", RuleParamType.STRING);
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheckTest.java
index 48ce2096..bb31a6f2 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR029StandardResponseSchemaCheckTest.java
@@ -24,6 +24,8 @@ public void init() {
v2Path = getV2Path("schemas");
v3Path = getV3Path("schemas");
v31Path = getV31Path("schemas");
+ v32Path = getV32Path("schemas");
+ v31Path = getV31Path("schemas");
}
@Test
@@ -96,26 +98,66 @@ public void verifyV3NoJsonContent() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3AllOf() {
verifyV3("valid-all-of");
}
+ @Test
+ public void verifyInV31AllOf() {
+ verifyV31("valid-all-of");
+ }
+ @Test
+ public void verifyInV32AllOf() {
+ verifyV32("valid-all-of");
+ }
@Test
public void verifyInV3ValidAllOfMd() {
verifyV3("valid-all-of-md");
}
+ @Test
+ public void verifyInV31ValidAllOfMd() {
+ verifyV31("valid-all-of-md");
+ }
+ @Test
+ public void verifyInV32ValidAllOfMd() {
+ verifyV32("valid-all-of-md");
+ }
@Test
public void verifyInV3ValidMd() {
verifyV3("valid-md");
}
+ @Test
+ public void verifyInV31ValidMd() {
+ verifyV31("valid-md");
+ }
+ @Test
+ public void verifyInV32ValidMd() {
+ verifyV32("valid-md");
+ }
@Test
public void verifyInV3ValidR() {
verifyV3("valid-r");
}
+ @Test
+ public void verifyInV31ValidR() {
+ verifyV31("valid-r");
+ }
+ @Test
+ public void verifyInV32ValidR() {
+ verifyV32("valid-r");
+ }
@Test
public void verifyV31Valid() {
@@ -156,7 +198,7 @@ public void verifyV2WithArrayTypePrimitiveItems() throws Exception {
public void verifyV2WithInvalidSchema() throws Exception {
setResponseSchema("not valid json");
List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
- new File(v2Path + "valid.yaml"), check, true, false, false);
+ new File(v2Path + "valid.yaml"), check, true, false, false, false);
assertThat(issues).isNotEmpty();
}
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR034StandardPagedResponseSchemaCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR034StandardPagedResponseSchemaCheckTest.java
index 0db4b1c2..91b760ee 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR034StandardPagedResponseSchemaCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR034StandardPagedResponseSchemaCheckTest.java
@@ -22,6 +22,8 @@ public void init() {
check = new OAR034StandardPagedResponseSchemaCheck();
v2Path = getV2Path("schemas");
v3Path = getV3Path("schemas");
+ v31Path = getV31Path("schemas");
+ v32Path = getV32Path("schemas");
}
@Test
@@ -73,51 +75,123 @@ public void verifyInV2WithoutPaginationRequiredFields() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3AllOf() {
verifyV3("valid-all-of");
}
+ @Test
+ public void verifyInV31AllOf() {
+ verifyV31("valid-all-of");
+ }
+ @Test
+ public void verifyInV32AllOf() {
+ verifyV32("valid-all-of");
+ }
@Test
public void verifyInV3WithoutPaging() {
verifyV3("without-paging");
}
+ @Test
+ public void verifyInV31WithoutPaging() {
+ verifyV31("without-paging");
+ }
+ @Test
+ public void verifyInV32WithoutPaging() {
+ verifyV32("without-paging");
+ }
@Test
public void verifyInV3WithPagingWrongType() {
verifyV3("with-paging-wrong-type");
}
+ @Test
+ public void verifyInV31WithPagingWrongType() {
+ verifyV31("with-paging-wrong-type");
+ }
+ @Test
+ public void verifyInV32WithPagingWrongType() {
+ verifyV32("with-paging-wrong-type");
+ }
@Test
public void verifyInV3WithPagingWithoutProperties() {
verifyV3("with-paging-without-properties");
}
+ @Test
+ public void verifyInV31WithPagingWithoutProperties() {
+ verifyV31("with-paging-without-properties");
+ }
+ @Test
+ public void verifyInV32WithPagingWithoutProperties() {
+ verifyV32("with-paging-without-properties");
+ }
@Test
public void verifyInV3WithPagingWithPropertiesWrongTypes() {
verifyV3("with-paging-with-properties-wrong-types");
}
+ @Test
+ public void verifyInV31WithPagingWithPropertiesWrongTypes() {
+ verifyV31("with-paging-with-properties-wrong-types");
+ }
+ @Test
+ public void verifyInV32WithPagingWithPropertiesWrongTypes() {
+ verifyV32("with-paging-with-properties-wrong-types");
+ }
@Test
public void verifyInV3WithLinksWithoutProperties() {
verifyV3("with-links-without-properties");
}
+ @Test
+ public void verifyInV31WithLinksWithoutProperties() {
+ verifyV31("with-links-without-properties");
+ }
+ @Test
+ public void verifyInV32WithLinksWithoutProperties() {
+ verifyV32("with-links-without-properties");
+ }
@Test
public void verifyInV3WithoutLinksRequiredFields() {
verifyV3("without-links-required-fields");
}
+ @Test
+ public void verifyInV31WithoutLinksRequiredFields() {
+ verifyV31("without-links-required-fields");
+ }
+ @Test
+ public void verifyInV32WithoutLinksRequiredFields() {
+ verifyV32("without-links-required-fields");
+ }
@Test
public void verifyInV3WithoutPaginationRequiredFields() {
verifyV3("without-pagination-required-fields");
}
+ @Test
+ public void verifyInV31WithoutPaginationRequiredFields() {
+ verifyV31("without-pagination-required-fields");
+ }
+ @Test
+ public void verifyInV32WithoutPaginationRequiredFields() {
+ verifyV32("without-pagination-required-fields");
+ }
@Test
public void verifyInV2WithPagingNoType() {
List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
- new File(v2Path + "with-paging-no-type.yaml"), check, true, false, false);
+ new File(v2Path + "with-paging-no-type.yaml"), check, true, false, false, false);
assertThat(issues).isNotEmpty();
}
@@ -126,13 +200,6 @@ public void verifyInV2WithPagingAllofWrongType() {
verifyV2("with-paging-allof-wrong-type.yaml");
}
- @Test
- public void verifyInV2WithoutPagingRequiredKey() {
- List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
- new File(v2Path + "without-paging-required-key.yaml"), check, true, false, false);
- assertThat(issues).isNotEmpty();
- }
-
@Override
public void verifyParameters() {
assertNumberOfParameters(1);
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheckTest.java
index 1f44678a..06cc991f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR080SecuritySchemasCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR080SecuritySchemasCheck();
v2Path = getV2Path("schemas");
v3Path = getV3Path("schemas");
+ v31Path = getV31Path("schemas");
+ v32Path = getV32Path("schemas");
}
@Test
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheckTest.java
index b8716e4a..66063382 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/schemas/OAR108SchemaValidatorCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR108SchemaValidatorCheck();
v2Path = getV2Path("schemas");
v3Path = getV3Path("schemas");
+ v31Path = getV31Path("schemas");
+ v32Path = getV32Path("schemas");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2Invalid() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3Invalid() {
verifyV3("invalid");
}
+ @Test
+ public void verifyInV31Invalid() {
+ verifyV31("invalid");
+ }
+ @Test
+ public void verifyInV32Invalid() {
+ verifyV32("invalid");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheckTest.java
index de939b23..a0814cbc 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR001MandatoryHttpsProtocolCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR001MandatoryHttpsProtocolCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2WithoutSchemes() {
public void verifyInV3WithServers() {
verifyV3("with-servers");
}
+ @Test
+ public void verifyInV31WithServers() {
+ verifyV31("with-servers");
+ }
+ @Test
+ public void verifyInV32WithServers() {
+ verifyV32("with-servers");
+ }
@Test
public void verifyInV3WithoutServers() {
verifyV3("without-servers");
}
+ @Test
+ public void verifyInV31WithoutServers() {
+ verifyV31("without-servers");
+ }
+ @Test
+ public void verifyInV32WithoutServers() {
+ verifyV32("without-servers");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheckTest.java
index c9c36162..50be7364 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR033HttpHeadersCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR033HttpHeadersCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -36,16 +38,40 @@ public void verifyInV2WithoutRequiredParams() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithForbiddenParams() {
verifyV3("with-forbidden-params");
}
+ @Test
+ public void verifyInV31WithForbiddenParams() {
+ verifyV31("with-forbidden-params");
+ }
+ @Test
+ public void verifyInV32WithForbiddenParams() {
+ verifyV32("with-forbidden-params");
+ }
@Test
public void verifyInV3WithoutRequiredParams() {
verifyV3("without-required-params");
}
+ @Test
+ public void verifyInV31WithoutRequiredParams() {
+ verifyV31("without-required-params");
+ }
+ @Test
+ public void verifyInV32WithoutRequiredParams() {
+ verifyV32("without-required-params");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR035AuthorizationResponsesCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR035AuthorizationResponsesCheckTest.java
index 9daca31d..cdd82acd 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR035AuthorizationResponsesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR035AuthorizationResponsesCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR035UnauthorizedResponseCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2WithoutAuthorizationResponses() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithoutAuthorizationResponses() {
verifyV3("without-authorization-responses");
}
+ @Test
+ public void verifyInV31WithoutAuthorizationResponses() {
+ verifyV31("without-authorization-responses");
+ }
+ @Test
+ public void verifyInV32WithoutAuthorizationResponses() {
+ verifyV32("without-authorization-responses");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismCheckTest.java
index bc6d7bd0..d8a816b1 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR036SessionMechanismCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR036SessionMechanismsCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2WithForbiddenParams() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithForbiddenParams() {
verifyV3("with-cookie");
}
+ @Test
+ public void verifyInV31WithForbiddenParams() {
+ verifyV31("with-cookie");
+ }
+ @Test
+ public void verifyInV32WithForbiddenParams() {
+ verifyV32("with-cookie");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR045DefinedResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR045DefinedResponseCheckTest.java
index cc6f72fe..63474060 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR045DefinedResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR045DefinedResponseCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR045DefinedResponseCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204CheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204CheckTest.java
index 8b2b90f1..d4f34fd8 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204CheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR049NoContentIn204CheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR049NoContentIn204Check();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -25,6 +27,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("no-content-in-204");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("no-content-in-204");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("no-content-in-204");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheckTest.java
index 6572c95a..1831534e 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR053ResponseHeadersCheckTest.java
@@ -5,7 +5,14 @@
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.rule.RuleParamType;
+import org.apiaddicts.apitools.dosonarapi.api.PreciseIssue;
import apiaddicts.sonar.openapi.BaseCheckTest;
+import apiaddicts.sonar.openapi.ExtendedOpenApiCheckVerifier;
+
+import java.io.File;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
public class OAR053ResponseHeadersCheckTest extends BaseCheckTest{
@Before
@@ -14,7 +21,9 @@ public void init() {
check = new OAR053ResponseHeadersCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
- }
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
+ }
@Test
@@ -25,7 +34,142 @@ public void verifyInV2(){
public void verifyInV3(){
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
+
+ @Test
+ public void verifyMissingHeaderInV2() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "missing-header.yaml"), check, true, false, false, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "missing-header.json"), check, true, false, false, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyMissingHeaderInV3() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "missing-header.yaml"), check, false, true, false, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "missing-header.json"), check, false, true, false, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyMissingHeaderInV31() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v31Path + "missing-header.yaml"), check, false, false, true, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v31Path + "missing-header.json"), check, false, false, true, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyMissingHeaderInV32() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v32Path + "missing-header.yaml"), check, false, false, false, true);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v32Path + "missing-header.json"), check, false, false, false, true);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyForbiddenHeaderInV2() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "forbidden-header.yaml"), check, true, false, false, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "forbidden-header.json"), check, true, false, false, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyForbiddenHeaderInV3() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "forbidden-header.yaml"), check, false, true, false, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "forbidden-header.json"), check, false, true, false, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyForbiddenHeaderInV31() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v31Path + "forbidden-header.yaml"), check, false, false, true, false);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v31Path + "forbidden-header.json"), check, false, false, true, false);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+ @Test
+ public void verifyForbiddenHeaderInV32() {
+ List yamlIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v32Path + "forbidden-header.yaml"), check, false, false, false, true);
+ assertThat(yamlIssues).isNotEmpty();
+ check = new OAR053ResponseHeadersCheck();
+ List jsonIssues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v32Path + "forbidden-header.json"), check, false, false, false, true);
+ assertThat(jsonIssues).isNotEmpty();
+ }
+
+ @Test
+ public void verifyExcludedPathInV2() {
+ verifyV2("excluded-path");
+ }
+
+ @Test
+ public void verifyExcludedPathInV3() {
+ verifyV3("excluded-path");
+ }
+
+ @Test
+ public void verifyExcludedPathInV31() {
+ verifyV31("excluded-path");
+ }
+
+ @Test
+ public void verifyExcludedPathInV32() {
+ verifyV32("excluded-path");
+ }
+
+ @Test
+ public void verifyExcludedCodeInV2() {
+ verifyV2("excluded-code");
+ }
+
+ @Test
+ public void verifyExcludedCodeInV3() {
+ verifyV3("excluded-code");
+ }
+
+ @Test
+ public void verifyExcludedCodeInV31() {
+ verifyV31("excluded-code");
+ }
+
+ @Test
+ public void verifyExcludedCodeInV32() {
+ verifyV32("excluded-code");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheckTest.java
index 8cff1395..a268a78c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR054HostCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR054HostCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -26,6 +28,14 @@ public void verifyInV2() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheckTest.java
index 976cbf19..d451e63c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR072NonOKModelResponseCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR072NonOKModelResponseCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2NoStackTrace() {
public void verifyInV3Compliant() {
verifyV3("with-stack-trace");
}
+ @Test
+ public void verifyInV31Compliant() {
+ verifyV31("with-stack-trace");
+ }
+ @Test
+ public void verifyInV32Compliant() {
+ verifyV32("with-stack-trace");
+ }
@Test
public void verifyInV3WithStackTrace() {
verifyV3("no-stack-trace");
}
+ @Test
+ public void verifyInV31WithStackTrace() {
+ verifyV31("no-stack-trace");
+ }
+ @Test
+ public void verifyInV32WithStackTrace() {
+ verifyV32("no-stack-trace");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR074NumericParameterIntegrityCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR074NumericParameterIntegrityCheckTest.java
index ff7994d6..b72ae91f 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR074NumericParameterIntegrityCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR074NumericParameterIntegrityCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR074NumericParameterIntegrityCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2noRestrictions() {
public void verifyInV3withRestrictions() {
verifyV3("with-restrictions");
}
+ @Test
+ public void verifyInV31withRestrictions() {
+ verifyV31("with-restrictions");
+ }
+ @Test
+ public void verifyInV32withRestrictions() {
+ verifyV32("with-restrictions");
+ }
@Test
public void verifyInV3noRestrictions() {
verifyV3("no-restrictions");
}
+ @Test
+ public void verifyInV31noRestrictions() {
+ verifyV31("no-restrictions");
+ }
+ @Test
+ public void verifyInV32noRestrictions() {
+ verifyV32("no-restrictions");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR075StringParameterIntegrityCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR075StringParameterIntegrityCheckTest.java
index 7f4723d7..35d3d780 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR075StringParameterIntegrityCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR075StringParameterIntegrityCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR075StringParameterIntegrityCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2noRestrictions() {
public void verifyInV3withRestrictions() {
verifyV3("with-restrictions");
}
+ @Test
+ public void verifyInV31withRestrictions() {
+ verifyV31("with-restrictions");
+ }
+ @Test
+ public void verifyInV32withRestrictions() {
+ verifyV32("with-restrictions");
+ }
@Test
public void verifyInV3noRestrictions() {
verifyV3("no-restrictions");
}
+ @Test
+ public void verifyInV31noRestrictions() {
+ verifyV31("no-restrictions");
+ }
+ @Test
+ public void verifyInV32noRestrictions() {
+ verifyV32("no-restrictions");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR076NumericFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR076NumericFormatCheckTest.java
index e1b7468d..4ee87c58 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR076NumericFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR076NumericFormatCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR076NumericFormatCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -35,11 +37,27 @@ public void verifyInV2WithNested() {
public void verifyInV3() {
verifyV3("plain");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("plain");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("plain");
+ }
@Test
public void verifyInV3WithNested() {
verifyV3("nested");
}
+ @Test
+ public void verifyInV31WithNested() {
+ verifyV31("nested");
+ }
+ @Test
+ public void verifyInV32WithNested() {
+ verifyV32("nested");
+ }
@Test
public void verifyInV3With$ref() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheckTest.java
index 3712f645..ab5db038 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR078VerbsSecurityCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR078VerbsSecurityCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,11 +32,27 @@ public void verifyInV2NoSecurity() {
public void verifyInV3WithSecurity() {
verifyV3("with-security");
}
+ @Test
+ public void verifyInV31WithSecurity() {
+ verifyV31("with-security");
+ }
+ @Test
+ public void verifyInV32WithSecurity() {
+ verifyV32("with-security");
+ }
@Test
public void verifyInV3NoSecurity() {
verifyV3("no-security");
}
+ @Test
+ public void verifyInV31NoSecurity() {
+ verifyV31("no-security");
+ }
+ @Test
+ public void verifyInV32NoSecurity() {
+ verifyV32("no-security");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR079PathParameter404CheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR079PathParameter404CheckTest.java
index d621120d..852a9ca0 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR079PathParameter404CheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR079PathParameter404CheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR079PathParameter404Check();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2NoBadRequest() {
public void verifyInV3BadRequest() {
verifyV3("bad-request404");
}
+ @Test
+ public void verifyInV31BadRequest() {
+ verifyV31("bad-request404");
+ }
+ @Test
+ public void verifyInV32BadRequest() {
+ verifyV32("bad-request404");
+ }
@Test
public void verifyInV3NoBadRequest() {
verifyV3("no-bad-request404");
}
+ @Test
+ public void verifyInV31NoBadRequest() {
+ verifyV31("no-bad-request404");
+ }
+ @Test
+ public void verifyInV32NoBadRequest() {
+ verifyV32("no-bad-request404");
+ }
@Test
public void verifyInV2NoParameters() {
@@ -51,11 +69,27 @@ public void verifyInV2QueryParamOnly() {
public void verifyInV3NoParameters() {
verifyV3("no-parameters");
}
+ @Test
+ public void verifyInV31NoParameters() {
+ verifyV31("no-parameters");
+ }
+ @Test
+ public void verifyInV32NoParameters() {
+ verifyV32("no-parameters");
+ }
@Test
public void verifyInV3QueryParamOnly() {
verifyV3("query-param-only");
}
+ @Test
+ public void verifyInV31QueryParamOnly() {
+ verifyV31("query-param-only");
+ }
+ @Test
+ public void verifyInV32QueryParamOnly() {
+ verifyV32("query-param-only");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheckTest.java
index 8bac7ac9..3354e4ee 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR081PasswordFormatCheckTest.java
@@ -14,6 +14,8 @@ public void init() {
check = new OAR081PasswordFormatCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -30,10 +32,26 @@ public void verifyInV3notvalid() {
verifyV3("not-valid-password");
}
@Test
+ public void verifyInV31notvalid() {
+ verifyV31("not-valid-password");
+ }
+ @Test
+ public void verifyInV32notvalid() {
+ verifyV32("not-valid-password");
+ }
+ @Test
public void verifyvalidV3() {
verifyV3("valid-password");
}
@Test
+ public void verifyvalidV31() {
+ verifyV31("valid-password");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-password");
+ }
+ @Test
public void verifyInV2Components() {
verifyV2("valid-with-components");
}
@@ -42,6 +60,14 @@ public void verifyInV2Components() {
public void verifyInV3Components() {
verifyV3("valid-with-components");
}
+ @Test
+ public void verifyInV31Components() {
+ verifyV31("valid-with-components");
+ }
+ @Test
+ public void verifyInV32Components() {
+ verifyV32("valid-with-components");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheckTest.java
index 11630b68..8efe8794 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR082BinaryOrByteFormatCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR082BinaryOrByteFormatCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
public void verifyvalidV2() {
@@ -24,6 +26,14 @@ public void verifyvalidV2() {
public void verifyvalidV3() {
verifyV3("valid-format");
}
+ @Test
+ public void verifyvalidV31() {
+ verifyV31("valid-format");
+ }
+ @Test
+ public void verifyvalidV32() {
+ verifyV32("valid-format");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR083ForbiddenQueryParamsCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR083ForbiddenQueryParamsCheckTest.java
index 9e6e6c72..feaa4291 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR083ForbiddenQueryParamsCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR083ForbiddenQueryParamsCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR083ForbiddenQueryParamsCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -67,26 +69,66 @@ public void verifyInV2EmptyForbiddenQueryParams() {
public void verifyInV3() {
verifyV3("valid-query-params");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid-query-params");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid-query-params");
+ }
@Test
public void verifyInV3ForbiddenQueryParams() {
verifyV3("forbidden-query-params");
}
+ @Test
+ public void verifyInV31ForbiddenQueryParams() {
+ verifyV31("forbidden-query-params");
+ }
+ @Test
+ public void verifyInV32ForbiddenQueryParams() {
+ verifyV32("forbidden-query-params");
+ }
@Test
public void verifyInV3NoParameters() {
verifyV3("no-parameters");
}
+ @Test
+ public void verifyInV31NoParameters() {
+ verifyV31("no-parameters");
+ }
+ @Test
+ public void verifyInV32NoParameters() {
+ verifyV32("no-parameters");
+ }
@Test
public void verifyInV3NullNameParam() {
verifyV3("null-name-param");
}
+ @Test
+ public void verifyInV31NullNameParam() {
+ verifyV31("null-name-param");
+ }
+ @Test
+ public void verifyInV32NullNameParam() {
+ verifyV32("null-name-param");
+ }
@Test
public void verifyInV3OptionsOperation() {
verifyV3("options-operation");
}
+ @Test
+ public void verifyInV31OptionsOperation() {
+ verifyV31("options-operation");
+ }
+ @Test
+ public void verifyInV32OptionsOperation() {
+ verifyV32("options-operation");
+ }
@Test
public void verifyPathFilteringStrategiesInV3() {
@@ -103,12 +145,28 @@ public void verifyPathFilteringStrategiesInV3() {
c.pathsStr = "/other";
verifyV3("valid-query-params");
}
+ @Test
+ public void verifyPathFilteringStrategiesInV31() {
+ verifyV31("valid-query-params");
+ }
+ @Test
+ public void verifyPathFilteringStrategiesInV32() {
+ verifyV32("valid-query-params");
+ }
@Test
public void verifyInV3EmptyForbiddenQueryParams() {
((OAR083ForbiddenQueryParamsCheck) check).forbiddenQueryParamsStr = "";
verifyV3("valid-query-params");
}
+ @Test
+ public void verifyInV31EmptyForbiddenQueryParams() {
+ verifyV31("valid-query-params");
+ }
+ @Test
+ public void verifyInV32EmptyForbiddenQueryParams() {
+ verifyV32("valid-query-params");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR084ForbiddenFormatsInQueryCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR084ForbiddenFormatsInQueryCheckTest.java
index bf863efc..023dba88 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR084ForbiddenFormatsInQueryCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR084ForbiddenFormatsInQueryCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR084ForbiddenFormatsInQueryCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -67,26 +69,66 @@ public void verifyInV2EmptyForbiddenQueryFormats() {
public void verifyInV3() {
verifyV3("valid-query-formats");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid-query-formats");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid-query-formats");
+ }
@Test
public void verifyInV3ForbiddenQueryFormats() {
verifyV3("forbidden-query-formats");
}
+ @Test
+ public void verifyInV31ForbiddenQueryFormats() {
+ verifyV31("forbidden-query-formats");
+ }
+ @Test
+ public void verifyInV32ForbiddenQueryFormats() {
+ verifyV32("forbidden-query-formats");
+ }
@Test
public void verifyInV3NoParameters() {
verifyV3("no-parameters");
}
+ @Test
+ public void verifyInV31NoParameters() {
+ verifyV31("no-parameters");
+ }
+ @Test
+ public void verifyInV32NoParameters() {
+ verifyV32("no-parameters");
+ }
@Test
public void verifyInV3NonQueryParam() {
verifyV3("non-query-param");
}
+ @Test
+ public void verifyInV31NonQueryParam() {
+ verifyV31("non-query-param");
+ }
+ @Test
+ public void verifyInV32NonQueryParam() {
+ verifyV32("non-query-param");
+ }
@Test
public void verifyInV3NullFormatParam() {
verifyV3("null-format-param");
}
+ @Test
+ public void verifyInV31NullFormatParam() {
+ verifyV31("null-format-param");
+ }
+ @Test
+ public void verifyInV32NullFormatParam() {
+ verifyV32("null-format-param");
+ }
@Test
public void verifyPathFilteringStrategiesInV3() {
@@ -102,12 +144,28 @@ public void verifyPathFilteringStrategiesInV3() {
c.pathsStr = "/other";
verifyV3("valid-query-formats");
}
+ @Test
+ public void verifyPathFilteringStrategiesInV31() {
+ verifyV31("valid-query-formats");
+ }
+ @Test
+ public void verifyPathFilteringStrategiesInV32() {
+ verifyV32("valid-query-formats");
+ }
@Test
public void verifyInV3EmptyForbiddenQueryFormats() {
((OAR084ForbiddenFormatsInQueryCheck) check).forbiddenQueryFormatsStr = "";
verifyV3("valid-query-formats");
}
+ @Test
+ public void verifyInV31EmptyForbiddenQueryFormats() {
+ verifyV31("valid-query-formats");
+ }
+ @Test
+ public void verifyInV32EmptyForbiddenQueryFormats() {
+ verifyV32("valid-query-formats");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheckTest.java
index 34987eea..3d09c539 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR085OpenAPIVersionCheckTest.java
@@ -6,6 +6,14 @@
import org.sonar.api.rules.RuleType;
import org.sonar.api.server.rule.RuleParamType;
import apiaddicts.sonar.openapi.BaseCheckTest;
+import apiaddicts.sonar.openapi.ExtendedOpenApiCheckVerifier;
+import org.apiaddicts.apitools.dosonarapi.api.PreciseIssue;
+import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.ValidationException;
+
+import java.io.File;
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
public class OAR085OpenAPIVersionCheckTest extends BaseCheckTest {
@@ -16,6 +24,7 @@ public void init() {
v2Path = getV2Path("security");
v3Path = getV3Path("security");
v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -32,15 +41,92 @@ public void verifyInvalidOpenApiVersionInV2() {
public void verifyInV3() {
verifyV3("valid-openapi-version");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid-openapi-version");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid-openapi-version");
+ }
@Test
public void verifyInvalidOpenApiVersionInV3() {
verifyV3("invalid-openapi-version");
}
+ @Test
+ public void verifyInvalidOpenApiVersionInV31() {
+ verifyV31("invalid-openapi-version");
+ }
+ @Test
+ public void verifyInvalidOpenApiVersionInV32() {
+ verifyV32("invalid-openapi-version");
+ }
@Test
- public void verifyInV31() {
- verifyV31("valid-openapi-version.yaml");
+ public void verifyTrulyInvalidVersionInV2() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "truly-invalid.yaml"), check, true, false, false, false);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
+ }
+
+ @Test
+ public void verifyTrulyInvalidVersionInV2Json() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v2Path + "truly-invalid.json"), check, true, false, false, false);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
+ }
+
+ @Test
+ public void verifyTrulyInvalidVersionInV3() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "truly-invalid.yaml"), check, false, true, false, false);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
+ }
+
+ @Test
+ public void verifyTrulyInvalidVersionInV3Json() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v3Path + "truly-invalid.json"), check, false, true, false, false);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
+ }
+
+ @Test
+ public void verifyTrulyInvalidVersionInV31() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v31Path + "truly-invalid.yaml"), check, false, false, true, false);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
+ }
+
+ @Test
+ public void verifyTrulyInvalidVersionInV32() {
+ try {
+ List issues = ExtendedOpenApiCheckVerifier.scanFileForIssues(
+ new File(v32Path + "truly-invalid.yaml"), check, false, false, false, true);
+ assertThat(issues).isNotEmpty();
+ } catch (ValidationException e) {
+ // Intentional blanck
+ }
}
@Override
@@ -51,6 +137,6 @@ public void verifyRule() {
@Override
public void verifyParameters() {
assertNumberOfParameters(1);
- assertParameterProperties("valid-versions", "2.0,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0", RuleParamType.STRING);
+ assertParameterProperties("valid-versions", "2.0,3.0.0,3.0.1,3.0.2,3.0.3,3.1.0,3.2.0", RuleParamType.STRING);
}
}
\ No newline at end of file
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR096ForbiddenResponseCheckTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR096ForbiddenResponseCheckTest.java
index f921186a..7785ea2d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR096ForbiddenResponseCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR096ForbiddenResponseCheckTest.java
@@ -15,6 +15,8 @@ public void init() {
check = new OAR096ForbiddenResponseCheck();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -31,11 +33,27 @@ public void verifyInV2WithoutAuthorizationResponses() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithoutAuthorizationResponses() {
verifyV3("without-authorization-responses");
}
+ @Test
+ public void verifyInV31WithoutAuthorizationResponses() {
+ verifyV31("without-authorization-responses");
+ }
+ @Test
+ public void verifyInV32WithoutAuthorizationResponses() {
+ verifyV32("without-authorization-responses");
+ }
@Override
public void verifyParameters() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecksTest.java b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecksTest.java
index d6f475c4..45f77caf 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecksTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/security/OAR114HttpResponseHeadersChecksTest.java
@@ -13,6 +13,8 @@ public void init() {
check = new OAR114HttpResponseHeadersChecks();
v2Path = getV2Path("security");
v3Path = getV3Path("security");
+ v31Path = getV31Path("security");
+ v32Path = getV32Path("security");
}
@Test
@@ -34,16 +36,40 @@ public void verifyInV2WithoutRequiredParams() {
public void verifyInV3() {
verifyV3("valid");
}
+ @Test
+ public void verifyInV31() {
+ verifyV31("valid");
+ }
+ @Test
+ public void verifyInV32() {
+ verifyV32("valid");
+ }
@Test
public void verifyInV3WithForbiddenParams() {
verifyV3("with-forbidden-params");
}
+ @Test
+ public void verifyInV31WithForbiddenParams() {
+ verifyV31("with-forbidden-params");
+ }
+ @Test
+ public void verifyInV32WithForbiddenParams() {
+ verifyV32("with-forbidden-params");
+ }
@Test
public void verifyInV3WithoutRequiredParams() {
verifyV3("without-required-params");
}
+ @Test
+ public void verifyInV31WithoutRequiredParams() {
+ verifyV31("without-required-params");
+ }
+ @Test
+ public void verifyInV32WithoutRequiredParams() {
+ verifyV32("without-required-params");
+ }
@Override
public void verifyRule() {
diff --git a/src/test/java/apiaddicts/sonar/openapi/utils/VerbPathMatcherTest.java b/src/test/java/apiaddicts/sonar/openapi/utils/VerbPathMatcherTest.java
new file mode 100644
index 00000000..b334ba7d
--- /dev/null
+++ b/src/test/java/apiaddicts/sonar/openapi/utils/VerbPathMatcherTest.java
@@ -0,0 +1,98 @@
+package apiaddicts.sonar.openapi.utils;
+
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Optional;
+import java.util.regex.Pattern;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class VerbPathMatcherTest {
+
+ @Test
+ public void testMatchesWithValuesExcluded() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$", "get:/items");
+ Optional result = matcher.matchesWithValues("get", "/items");
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void testMatchesWithValuesMatched() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$");
+ Optional result = matcher.matchesWithValues("get", "/items");
+ assertThat(result).isPresent();
+ }
+
+ @Test
+ public void testMatchesWithValuesNoMatch() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$");
+ Optional result = matcher.matchesWithValues("get", "/other");
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void testMatchesWithUnknownVerb() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$");
+ Optional result = matcher.matchesWithValues("post", "/items");
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void testPatternGroupStrToSetWithNull() {
+ VerbPathMatcher.PatternGroup pg = new VerbPathMatcher.PatternGroup(
+ Pattern.compile(".*"), Collections.singletonList(null));
+ assertThat(pg.getValues()).isEmpty();
+ }
+
+ @Test
+ public void testPatternGroupWithValues() {
+ VerbPathMatcher.PatternGroup pg = new VerbPathMatcher.PatternGroup(
+ Pattern.compile(".*"), Arrays.asList("a,b", "c"));
+ assertThat(pg.getValues(0)).containsExactlyInAnyOrder("a", "b");
+ assertThat(pg.getValues(1)).containsExactly("c");
+ }
+
+ @Test
+ public void testMatchesReturnsFalseForMultipleMeWords() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/me/[^/{}]*/me$");
+ Optional result = matcher.matchesWithValues("get", "/me/pets/me");
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void testMatchesReturnsTrueForSingleMeWord() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/me$");
+ Optional result = matcher.matchesWithValues("get", "/me");
+ assertThat(result).isPresent();
+ }
+
+ @Test
+ public void testExpressionWithMultipleVerbs() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get,post:^/items$");
+ assertThat(matcher.matchesWithValues("get", "/items")).isPresent();
+ assertThat(matcher.matchesWithValues("post", "/items")).isPresent();
+ }
+
+ @Test
+ public void testExpressionWithMultiplePatterns() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$,^/users$");
+ assertThat(matcher.matchesWithValues("get", "/items")).isPresent();
+ assertThat(matcher.matchesWithValues("get", "/users")).isPresent();
+ }
+
+ @Test
+ public void testNullExclusionExpression() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$", null);
+ assertThat(matcher.matchesWithValues("get", "/items")).isPresent();
+ }
+
+ @Test
+ public void testExpressionWithValues() {
+ VerbPathMatcher matcher = new VerbPathMatcher("get:^/items$:value1,value2");
+ Optional result = matcher.matchesWithValues("get", "/items");
+ assertThat(result).isPresent();
+ assertThat(result.get().getValues()).containsExactlyInAnyOrder("value1", "value2");
+ }
+}
diff --git a/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.json b/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.json
new file mode 100644
index 00000000..c33df6db
--- /dev/null
+++ b/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROL€_V¡€U" ], # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.yaml b/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.yaml
new file mode 100644
index 00000000..cbfa1337
--- /dev/null
+++ b/src/test/resources/checks/v2/apim/wso2/OAR004/with-invalid-array-roles.yaml
@@ -0,0 +1,16 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.json b/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.json
new file mode 100644
index 00000000..45e521d9
--- /dev/null
+++ b/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROLE_VIEW" ],
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.yaml b/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.yaml
new file mode 100644
index 00000000..7bf72080
--- /dev/null
+++ b/src/test/resources/checks/v2/apim/wso2/OAR004/with-valid-array-roles.yaml
@@ -0,0 +1,16 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROLE_VIEW
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v2/examples/OAR031/allof-schema.json b/src/test/resources/checks/v2/examples/OAR031/allof-schema.json
new file mode 100644
index 00000000..177244f6
--- /dev/null
+++ b/src/test/resources/checks/v2/examples/OAR031/allof-schema.json
@@ -0,0 +1,48 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "definitions" : {
+ "BaseEntity" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "integer",
+ "example" : 1
+ }
+ }
+ },
+ "Pet" : {
+ "allOf" : [ {
+ "$ref" : "#/definitions/BaseEntity"
+ } ],
+ "properties" : {
+ "name" : {
+ "type" : "string",
+ "example" : "Fluffy"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "schema" : {
+ "$ref" : "#/definitions/Pet"
+ },
+ "examples" : {
+ "application/json" : {
+ "name" : "Fluffy"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/examples/OAR031/allof-schema.yaml b/src/test/resources/checks/v2/examples/OAR031/allof-schema.yaml
new file mode 100644
index 00000000..fefb074b
--- /dev/null
+++ b/src/test/resources/checks/v2/examples/OAR031/allof-schema.yaml
@@ -0,0 +1,29 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+definitions:
+ BaseEntity:
+ type: object
+ properties:
+ id:
+ type: integer
+ example: 1
+ Pet:
+ allOf:
+ - $ref: '#/definitions/BaseEntity'
+ properties:
+ name:
+ type: string
+ example: "Fluffy"
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ schema:
+ $ref: '#/definitions/Pet'
+ examples:
+ application/json:
+ name: Fluffy
diff --git a/src/test/resources/checks/v2/examples/OAR031/valid.yaml b/src/test/resources/checks/v2/examples/OAR031/valid.yaml
index 21990b09..abb84e89 100644
--- a/src/test/resources/checks/v2/examples/OAR031/valid.yaml
+++ b/src/test/resources/checks/v2/examples/OAR031/valid.yaml
@@ -51,7 +51,7 @@ definitions:
size:
type: integer
example: 1
- pets: # Noncompliant {{OAR031: Properties must have an example defined}}
+ pets:
type: array
items:
$ref: '#/definitions/pet'
diff --git a/src/test/resources/checks/v2/examples/OAR031/without-examples.yaml b/src/test/resources/checks/v2/examples/OAR031/without-examples.yaml
index b877dfa4..cfb67cc7 100644
--- a/src/test/resources/checks/v2/examples/OAR031/without-examples.yaml
+++ b/src/test/resources/checks/v2/examples/OAR031/without-examples.yaml
@@ -48,7 +48,7 @@ definitions:
properties:
size: # Noncompliant {{OAR031: Properties must have an example defined}}
type: integer
- pets: # Noncompliant {{OAR031: Properties must have an example defined}}
+ pets:
type: array
items:
$ref: '#/definitions/pet'
diff --git a/src/test/resources/checks/v2/format/OAR037/blank-format.json b/src/test/resources/checks/v2/format/OAR037/blank-format.json
new file mode 100644
index 00000000..05b6299e
--- /dev/null
+++ b/src/test/resources/checks/v2/format/OAR037/blank-format.json
@@ -0,0 +1,27 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/invoices" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "A invoice.",
+ "schema" : {
+ "type" : "object",
+ "properties" : {
+ "blank_format" : {
+ "type" : "string",
+ "format" : ""
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/format/OAR037/blank-format.yaml b/src/test/resources/checks/v2/format/OAR037/blank-format.yaml
new file mode 100644
index 00000000..00464338
--- /dev/null
+++ b/src/test/resources/checks/v2/format/OAR037/blank-format.yaml
@@ -0,0 +1,16 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ schema:
+ type: object
+ properties:
+ blank_format:
+ type: string
+ format: ""
diff --git a/src/test/resources/checks/v2/format/OAR037/plain.json b/src/test/resources/checks/v2/format/OAR037/plain.json
index 7a695aca..038c38a3 100644
--- a/src/test/resources/checks/v2/format/OAR037/plain.json
+++ b/src/test/resources/checks/v2/format/OAR037/plain.json
@@ -14,7 +14,7 @@
"type" : "object",
"properties" : {
"without" : {
- "type" : "string"
+ "type" : "string" # Noncompliant {{OAR037: String types requires a valid format}}
},
"date" : {
"type" : "string",
diff --git a/src/test/resources/checks/v2/format/OAR037/plain.yaml b/src/test/resources/checks/v2/format/OAR037/plain.yaml
index e58efd2a..957f5bc1 100644
--- a/src/test/resources/checks/v2/format/OAR037/plain.yaml
+++ b/src/test/resources/checks/v2/format/OAR037/plain.yaml
@@ -12,7 +12,7 @@ paths:
type: object
properties:
without:
- type: string
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
date:
type: string
format: date
diff --git a/src/test/resources/checks/v2/format/OAR051/different-description.json b/src/test/resources/checks/v2/format/OAR051/different-description.json
index 7b5a5306..82c54c22 100644
--- a/src/test/resources/checks/v2/format/OAR051/different-description.json
+++ b/src/test/resources/checks/v2/format/OAR051/different-description.json
@@ -8,7 +8,8 @@
"/pets" : {
"post" : {
"summary" : "create a pet",
- "description" : "Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other operations.",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "Create a pet",
"responses" : {
"default" : {
"description" : "the default response"
diff --git a/src/test/resources/checks/v2/format/OAR051/different-description.yaml b/src/test/resources/checks/v2/format/OAR051/different-description.yaml
index 3cb9810d..03a4f52e 100644
--- a/src/test/resources/checks/v2/format/OAR051/different-description.yaml
+++ b/src/test/resources/checks/v2/format/OAR051/different-description.yaml
@@ -6,8 +6,8 @@ paths:
/pets:
post:
summary: create a pet
- description: Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other
- operations.
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: Create a pet
responses:
default:
description: the default response
diff --git a/src/test/resources/checks/v2/format/OAR066/snake-case-error.json b/src/test/resources/checks/v2/format/OAR066/snake-case-error.json
index 9164a423..1dff8698 100644
--- a/src/test/resources/checks/v2/format/OAR066/snake-case-error.json
+++ b/src/test/resources/checks/v2/format/OAR066/snake-case-error.json
@@ -19,7 +19,15 @@
"type": "string"
},
"last_name": {
- "type": "string"
+ "type": "object",
+ "properties": {
+ "streetName": { # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "type": "string"
+ },
+ "street_name": {
+ "type": "string"
+ }
+ }
}
}
}
@@ -35,7 +43,15 @@
"type": "integer"
},
"user_name": {
- "type": "string"
+ "type": "object",
+ "properties": {
+ "userId": { # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "type": "integer"
+ },
+ "user_id": {
+ "type": "integer"
+ }
+ }
}
}
}
diff --git a/src/test/resources/checks/v2/format/OAR066/snake-case-error.yaml b/src/test/resources/checks/v2/format/OAR066/snake-case-error.yaml
index b3142268..9dbeb577 100644
--- a/src/test/resources/checks/v2/format/OAR066/snake-case-error.yaml
+++ b/src/test/resources/checks/v2/format/OAR066/snake-case-error.yaml
@@ -15,7 +15,12 @@ paths:
firstName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
type: string
last_name:
- type: string
+ type: object
+ properties:
+ streetName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ street_name:
+ type: string
responses:
'200':
description: Success
@@ -25,4 +30,9 @@ paths:
userId: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
type: integer
user_name:
- type: string
\ No newline at end of file
+ type: object
+ properties:
+ userId: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_id:
+ type: integer
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/format/OAR066/valid.json b/src/test/resources/checks/v2/format/OAR066/valid.json
index fdf47c6c..3a488b7a 100644
--- a/src/test/resources/checks/v2/format/OAR066/valid.json
+++ b/src/test/resources/checks/v2/format/OAR066/valid.json
@@ -20,6 +20,24 @@
},
"last_name": {
"type": "string"
+ },
+ "_links": {
+ "type": "object"
+ },
+ "_embedded": {
+ "type": "object"
+ },
+ "@context": {
+ "type": "string"
+ },
+ "@type": {
+ "type": "string"
+ },
+ "@id": {
+ "type": "string"
+ },
+ "x-internal": {
+ "type": "boolean"
}
}
}
diff --git a/src/test/resources/checks/v2/format/OAR066/valid.yaml b/src/test/resources/checks/v2/format/OAR066/valid.yaml
index 623f70ac..29831526 100644
--- a/src/test/resources/checks/v2/format/OAR066/valid.yaml
+++ b/src/test/resources/checks/v2/format/OAR066/valid.yaml
@@ -16,6 +16,18 @@ paths:
type: string
last_name:
type: string
+ _links:
+ type: object
+ _embedded:
+ type: object
+ "@context":
+ type: string
+ "@type":
+ type: string
+ "@id":
+ type: string
+ x-internal:
+ type: boolean
responses:
'200':
description: Success
diff --git a/src/test/resources/checks/v2/operations/OAR014/plain.json b/src/test/resources/checks/v2/operations/OAR014/plain.json
index 1dc0ee29..7561c445 100644
--- a/src/test/resources/checks/v2/operations/OAR014/plain.json
+++ b/src/test/resources/checks/v2/operations/OAR014/plain.json
@@ -95,7 +95,7 @@
}
}
},
- "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six": {
+ "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
"get": {
"responses": {
"default": {
@@ -104,7 +104,7 @@
}
}
},
- "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}": {
+ "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
"get": {
"responses": {
"default": {
diff --git a/src/test/resources/checks/v2/operations/OAR014/plain.yaml b/src/test/resources/checks/v2/operations/OAR014/plain.yaml
index 385ef638..abae063e 100644
--- a/src/test/resources/checks/v2/operations/OAR014/plain.yaml
+++ b/src/test/resources/checks/v2/operations/OAR014/plain.yaml
@@ -53,12 +53,12 @@ paths:
responses:
default:
description: Ok
- /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six:
+ /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
responses:
default:
description: Ok
- /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}:
+ /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}: # Noncompliant {{OAR014: Resources depth level should be smaller}}
get:
responses:
default:
diff --git a/src/test/resources/checks/v2/operations/OAR015/plain.json b/src/test/resources/checks/v2/operations/OAR015/plain.json
index 53082e2b..d8f8fc1d 100644
--- a/src/test/resources/checks/v2/operations/OAR015/plain.json
+++ b/src/test/resources/checks/v2/operations/OAR015/plain.json
@@ -123,4 +123,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/checks/v2/operations/OAR015/plain.yaml b/src/test/resources/checks/v2/operations/OAR015/plain.yaml
index 8e617f60..19bce139 100644
--- a/src/test/resources/checks/v2/operations/OAR015/plain.yaml
+++ b/src/test/resources/checks/v2/operations/OAR015/plain.yaml
@@ -67,4 +67,4 @@ paths:
get:
responses:
default:
- description: Ok
\ No newline at end of file
+ description: Ok
diff --git a/src/test/resources/checks/v2/operations/OAR017/plain.json b/src/test/resources/checks/v2/operations/OAR017/plain.json
index 90ee820f..360eff66 100644
--- a/src/test/resources/checks/v2/operations/OAR017/plain.json
+++ b/src/test/resources/checks/v2/operations/OAR017/plain.json
@@ -7,57 +7,48 @@
"paths": {
"/": {
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
}
},
"/one": {
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
}
},
- "/{one}": {
+ "/{one}": { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
}
},
- "/one/two": {
+ "/one/two": { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
+ }
+ },
+ "/one/me": {
+ "get": {
+ "responses": { "200": { "description": "Ok" } }
+ }
+ },
+ "/one/me/three": {
+ "get": {
+ "responses": { "200": { "description": "Ok" } }
}
},
"/one/{two}": {
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
}
},
"/one/{two}/three": {
"get": {
- "responses": {
- "200": {
- "description": "Ok"
- }
- }
+ "responses": { "200": { "description": "Ok" } }
+ }
+ },
+ "/one/{two}/{three}": { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get": {
+ "responses": { "200": { "description": "Ok" } }
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/checks/v2/operations/OAR017/plain.yaml b/src/test/resources/checks/v2/operations/OAR017/plain.yaml
index 66bf785d..81d61480 100644
--- a/src/test/resources/checks/v2/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v2/operations/OAR017/plain.yaml
@@ -13,12 +13,12 @@ paths:
responses:
200:
description: "Ok"
- /{one}:
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
get:
responses:
200:
description: "Ok"
- /one/two:
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
get:
responses:
200:
@@ -33,3 +33,18 @@ paths:
responses:
200:
description: "Ok"
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: "Ok"
+ /one/me/three:
+ get:
+ responses:
+ 200:
+ description: "Ok"
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: "Ok"
diff --git a/src/test/resources/checks/v2/operations/OAR038/valid-with-error.json b/src/test/resources/checks/v2/operations/OAR038/valid-with-error.json
new file mode 100644
index 00000000..ebd24923
--- /dev/null
+++ b/src/test/resources/checks/v2/operations/OAR038/valid-with-error.json
@@ -0,0 +1,39 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "schema" : {
+ "$ref" : "#/definitions/response"
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "definitions" : {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "error" : {
+ "type" : "object",
+ "properties" : {
+ "message" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/operations/OAR038/valid-with-error.yaml b/src/test/resources/checks/v2/operations/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..d553faaa
--- /dev/null
+++ b/src/test/resources/checks/v2/operations/OAR038/valid-with-error.yaml
@@ -0,0 +1,24 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ schema:
+ $ref: '#/definitions/response'
+ 204:
+ description: No content
+
+definitions:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.json b/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..96b00628
--- /dev/null
+++ b/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.json
@@ -0,0 +1,39 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "schema" : {
+ "$ref" : "#/definitions/response"
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "definitions" : {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..f3683a63
--- /dev/null
+++ b/src/test/resources/checks/v2/operations/OAR038/with-invalid-property.yaml
@@ -0,0 +1,24 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ schema:
+ $ref: '#/definitions/response'
+ 204:
+ description: No content
+
+definitions:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v2/operations/OAR038/without-data.json b/src/test/resources/checks/v2/operations/OAR038/without-data.json
index 8bd0079f..f6c8a094 100644
--- a/src/test/resources/checks/v2/operations/OAR038/without-data.json
+++ b/src/test/resources/checks/v2/operations/OAR038/without-data.json
@@ -22,7 +22,7 @@
}
},
"definitions" : {
- "response" : { # Noncompliant {{OAR038: 'data' property is missing}}
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
"type" : "object"
}
}
diff --git a/src/test/resources/checks/v2/operations/OAR038/without-data.yaml b/src/test/resources/checks/v2/operations/OAR038/without-data.yaml
index f62c4f51..0e284414 100644
--- a/src/test/resources/checks/v2/operations/OAR038/without-data.yaml
+++ b/src/test/resources/checks/v2/operations/OAR038/without-data.yaml
@@ -14,5 +14,5 @@ paths:
description: No content
definitions:
- response: # Noncompliant {{OAR038: 'data' property is missing}}
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.json b/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.json
new file mode 100644
index 00000000..46061ed4
--- /dev/null
+++ b/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.json
@@ -0,0 +1,57 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Health Check Excluded Paths API"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Health check - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health": {
+ "get": {
+ "summary": "Health endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health-check": {
+ "get": {
+ "summary": "Health check endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/ping": {
+ "get": {
+ "summary": "Ping endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/liveness": {
+ "get": {
+ "summary": "Liveness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/readiness": {
+ "get": {
+ "summary": "Readiness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.yaml b/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.yaml
new file mode 100644
index 00000000..6e800d56
--- /dev/null
+++ b/src/test/resources/checks/v2/owasp/OAR073/health-check-excluded.yaml
@@ -0,0 +1,41 @@
+swagger: '2.0'
+info:
+ version: 1.0.0
+ title: Health Check Excluded Paths API
+paths:
+ /status:
+ get:
+ summary: Health check - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health:
+ get:
+ summary: Health endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health-check:
+ get:
+ summary: Health check endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /ping:
+ get:
+ summary: Ping endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /liveness:
+ get:
+ summary: Liveness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /readiness:
+ get:
+ summary: Readiness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.json b/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.json
new file mode 100644
index 00000000..42b242d0
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.json
@@ -0,0 +1,26 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "expand",
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.yaml b/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.yaml
new file mode 100644
index 00000000..b40045e0
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR020/expand-no-dollar.yaml
@@ -0,0 +1,16 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: expand
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.json b/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.json
new file mode 100644
index 00000000..2306e767
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.json
@@ -0,0 +1,26 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "exclude",
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.yaml b/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.yaml
new file mode 100644
index 00000000..b222ea24
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR021/exclude-no-dollar.yaml
@@ -0,0 +1,16 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: exclude
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.json b/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.json
index 01030ba9..6debb878 100644
--- a/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.json
+++ b/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.json
@@ -5,18 +5,18 @@
"title" : "Swagger Petstore"
},
"paths" : {
- "/status" : {
- "get" : {
+ "/orders" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
"parameters" : [ {
"in" : "query",
- "name" : "other", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "other",
"type" : "array",
"items" : {
"type" : "string"
}
}, {
"in" : "query",
- "name" : "select", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "select",
"type" : "array",
"items" : {
"type" : "string"
diff --git a/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.yaml b/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.yaml
index 5b5548d1..9f45515e 100644
--- a/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.yaml
+++ b/src/test/resources/checks/v2/parameters/OAR028/exclude-noncompliant.yaml
@@ -3,16 +3,16 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /status:
- get:
+ /orders:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
parameters:
- in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
type: array
items:
type: string
- in: query
- name: select # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: select
type: array
items:
type: string
diff --git a/src/test/resources/checks/v2/parameters/OAR028/header-ignored.json b/src/test/resources/checks/v2/parameters/OAR028/header-ignored.json
new file mode 100644
index 00000000..95fc1e97
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR028/header-ignored.json
@@ -0,0 +1,30 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "header",
+ "name" : "Authorization",
+ "type" : "string"
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR028/header-ignored.yaml b/src/test/resources/checks/v2/parameters/OAR028/header-ignored.yaml
new file mode 100644
index 00000000..7ec8978e
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR028/header-ignored.yaml
@@ -0,0 +1,19 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: header
+ name: Authorization
+ type: string
+ - in: query
+ name: $filter
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.json b/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.json
new file mode 100644
index 00000000..25e15525
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.json
@@ -0,0 +1,63 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "post" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me/settings" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/health" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/ping" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.yaml b/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.yaml
new file mode 100644
index 00000000..50c39dc6
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR028/me-health-ping.yaml
@@ -0,0 +1,35 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ post:
+ responses:
+ 206:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me/settings:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /health:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /ping:
+ get:
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v2/parameters/OAR028/plain-without.json b/src/test/resources/checks/v2/parameters/OAR028/plain-without.json
index 79714f09..030fcb40 100644
--- a/src/test/resources/checks/v2/parameters/OAR028/plain-without.json
+++ b/src/test/resources/checks/v2/parameters/OAR028/plain-without.json
@@ -6,17 +6,17 @@
},
"paths" : {
"/examples" : {
- "get" : {
- "parameters" : [ {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
"in" : "query",
- "name" : "other", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "other",
"type" : "array",
"items" : {
"type" : "string"
}
}, {
"in" : "query",
- "name" : "hola", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "hola",
"type" : "array",
"items" : {
"type" : "string"
@@ -30,4 +30,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR028/plain-without.yaml b/src/test/resources/checks/v2/parameters/OAR028/plain-without.yaml
index 6f972993..80432464 100644
--- a/src/test/resources/checks/v2/parameters/OAR028/plain-without.yaml
+++ b/src/test/resources/checks/v2/parameters/OAR028/plain-without.yaml
@@ -4,18 +4,18 @@ info:
title: Swagger Petstore
paths:
/examples:
- get:
- parameters:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
type: array
items:
type: string
- in: query
- name: hola # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: hola
type: array
items:
type: string
responses:
206:
- description: Ok
\ No newline at end of file
+ description: Ok
diff --git a/src/test/resources/checks/v2/resources/OAR017/plain.yaml b/src/test/resources/checks/v2/resources/OAR017/plain.yaml
index af323291..2a16af5a 100644
--- a/src/test/resources/checks/v2/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v2/resources/OAR017/plain.yaml
@@ -56,32 +56,8 @@ paths:
200:
description: Ok
- /one/get:
+ /me/items/{id}:
get:
responses:
200:
description: Ok
-
- /one/get/three/get: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
- get:
- responses:
- 200:
- description: Ok
-
- /one/{two}/three/get:
- get:
- responses:
- 200:
- description: Ok
-
- /one/{two}/three/{four}/get: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
- get:
- responses:
- 200:
- description: Ok
-
- /one/{two}/three/{four}/five/get:
- get:
- responses:
- 200:
- description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/resources/OAR038/valid-with-error.json b/src/test/resources/checks/v2/resources/OAR038/valid-with-error.json
new file mode 100644
index 00000000..edd22520
--- /dev/null
+++ b/src/test/resources/checks/v2/resources/OAR038/valid-with-error.json
@@ -0,0 +1,6 @@
+{
+ "swagger": "2.0",
+ "info": { "version": "1.0.0", "title": "Swagger Petstore" },
+ "paths": { "/endpoint": { "post": { "responses": { "201": { "description": "Ok", "schema": { "$ref": "#/definitions/response" } }, "204": { "description": "No content" } } } } },
+ "definitions": { "response": { "type": "object", "properties": { "error": { "type": "object", "properties": { "message": { "type": "string" } } } } } }
+}
diff --git a/src/test/resources/checks/v2/resources/OAR038/valid-with-error.yaml b/src/test/resources/checks/v2/resources/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..d553faaa
--- /dev/null
+++ b/src/test/resources/checks/v2/resources/OAR038/valid-with-error.yaml
@@ -0,0 +1,24 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ schema:
+ $ref: '#/definitions/response'
+ 204:
+ description: No content
+
+definitions:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.json b/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..dba7a4b4
--- /dev/null
+++ b/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.json
@@ -0,0 +1,7 @@
+{
+ "swagger": "2.0",
+ "info": { "version": "1.0.0", "title": "Swagger Petstore" },
+ "paths": { "/endpoint": { "post": { "responses": { "201": { "description": "Ok", "schema": { "$ref": "#/definitions/response" } }, "204": { "description": "No content" } } } } },
+ "definitions": { "response": { "type": "object", "properties": { "invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type": "object", "properties": { "id": { "type": "string" } } } } } }
+}
diff --git a/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..f3683a63
--- /dev/null
+++ b/src/test/resources/checks/v2/resources/OAR038/with-invalid-property.yaml
@@ -0,0 +1,24 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ schema:
+ $ref: '#/definitions/response'
+ 204:
+ description: No content
+
+definitions:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v2/resources/OAR038/without-data.json b/src/test/resources/checks/v2/resources/OAR038/without-data.json
index 8bd0079f..f6c8a094 100644
--- a/src/test/resources/checks/v2/resources/OAR038/without-data.json
+++ b/src/test/resources/checks/v2/resources/OAR038/without-data.json
@@ -22,7 +22,7 @@
}
},
"definitions" : {
- "response" : { # Noncompliant {{OAR038: 'data' property is missing}}
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
"type" : "object"
}
}
diff --git a/src/test/resources/checks/v2/resources/OAR038/without-data.yaml b/src/test/resources/checks/v2/resources/OAR038/without-data.yaml
index f62c4f51..0e284414 100644
--- a/src/test/resources/checks/v2/resources/OAR038/without-data.yaml
+++ b/src/test/resources/checks/v2/resources/OAR038/without-data.yaml
@@ -14,5 +14,5 @@ paths:
description: No content
definitions:
- response: # Noncompliant {{OAR038: 'data' property is missing}}
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/security/OAR053/excluded-code.json b/src/test/resources/checks/v2/security/OAR053/excluded-code.json
new file mode 100644
index 00000000..6933e319
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/excluded-code.json
@@ -0,0 +1,18 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No Content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/security/OAR053/excluded-code.yaml b/src/test/resources/checks/v2/security/OAR053/excluded-code.yaml
new file mode 100644
index 00000000..0ac8a88f
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/excluded-code.yaml
@@ -0,0 +1,11 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ delete:
+ responses:
+ '204':
+ description: No Content
diff --git a/src/test/resources/checks/v2/security/OAR053/excluded-path.json b/src/test/resources/checks/v2/security/OAR053/excluded-path.json
new file mode 100644
index 00000000..ddc5c18c
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/excluded-path.json
@@ -0,0 +1,18 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/security/OAR053/excluded-path.yaml b/src/test/resources/checks/v2/security/OAR053/excluded-path.yaml
new file mode 100644
index 00000000..dea3cf23
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/excluded-path.yaml
@@ -0,0 +1,11 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /status:
+ get:
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v2/security/OAR053/forbidden-header.json b/src/test/resources/checks/v2/security/OAR053/forbidden-header.json
new file mode 100644
index 00000000..77daf75d
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/forbidden-header.json
@@ -0,0 +1,23 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-forbidden-custom-header": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/security/OAR053/forbidden-header.yaml b/src/test/resources/checks/v2/security/OAR053/forbidden-header.yaml
new file mode 100644
index 00000000..0bf30618
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/forbidden-header.yaml
@@ -0,0 +1,14 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ x-forbidden-custom-header:
+ type: string
diff --git a/src/test/resources/checks/v2/security/OAR053/missing-header.json b/src/test/resources/checks/v2/security/OAR053/missing-header.json
new file mode 100644
index 00000000..88f1770f
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/missing-header.json
@@ -0,0 +1,23 @@
+{
+ "swagger": "2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "idCorrelacion": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/security/OAR053/missing-header.yaml b/src/test/resources/checks/v2/security/OAR053/missing-header.yaml
new file mode 100644
index 00000000..401c7c6c
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR053/missing-header.yaml
@@ -0,0 +1,14 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ idCorrelacion:
+ type: string
diff --git a/src/test/resources/checks/v2/security/OAR085/truly-invalid.json b/src/test/resources/checks/v2/security/OAR085/truly-invalid.json
new file mode 100644
index 00000000..ec03effe
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR085/truly-invalid.json
@@ -0,0 +1,9 @@
+{
+ "swagger": "1.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API with an invalid swagger version.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
diff --git a/src/test/resources/checks/v2/security/OAR085/truly-invalid.yaml b/src/test/resources/checks/v2/security/OAR085/truly-invalid.yaml
new file mode 100644
index 00000000..0f0347b2
--- /dev/null
+++ b/src/test/resources/checks/v2/security/OAR085/truly-invalid.yaml
@@ -0,0 +1,6 @@
+swagger: "1.0"
+info:
+ title: Sample API
+ description: This is a sample API with an invalid swagger version.
+ version: "1.0.0"
+paths: {}
diff --git a/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.json b/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.json
new file mode 100644
index 00000000..48350b93
--- /dev/null
+++ b/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROL€_V¡€U" ], # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.yaml b/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.yaml
new file mode 100644
index 00000000..2958720b
--- /dev/null
+++ b/src/test/resources/checks/v3/apim/wso2/OAR004/with-invalid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.json b/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.json
new file mode 100644
index 00000000..1be50d89
--- /dev/null
+++ b/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROLE_VIEW" ],
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.yaml b/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.yaml
new file mode 100644
index 00000000..c943d6f1
--- /dev/null
+++ b/src/test/resources/checks/v3/apim/wso2/OAR004/with-valid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROLE_VIEW
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v3/core/OAR045/defined-response.json b/src/test/resources/checks/v3/core/OAR045/defined-response.json
new file mode 100644
index 00000000..f86d6ac4
--- /dev/null
+++ b/src/test/resources/checks/v3/core/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/core/OAR045/defined-response.yaml b/src/test/resources/checks/v3/core/OAR045/defined-response.yaml
new file mode 100644
index 00000000..4370ac6c
--- /dev/null
+++ b/src/test/resources/checks/v3/core/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: 3.0.0
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v3/examples/OAR031/allof-schema.json b/src/test/resources/checks/v3/examples/OAR031/allof-schema.json
new file mode 100644
index 00000000..92f78ec7
--- /dev/null
+++ b/src/test/resources/checks/v3/examples/OAR031/allof-schema.json
@@ -0,0 +1,55 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components" : {
+ "schemas" : {
+ "BaseEntity" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "integer",
+ "example" : 1
+ }
+ }
+ },
+ "Pet" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/BaseEntity"
+ } ],
+ "properties" : {
+ "name" : {
+ "type" : "string",
+ "example" : "Fluffy"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/Pet"
+ },
+ "example" : {
+ "name" : "Fluffy"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/examples/OAR031/allof-schema.yaml b/src/test/resources/checks/v3/examples/OAR031/allof-schema.yaml
new file mode 100644
index 00000000..d3ebc8df
--- /dev/null
+++ b/src/test/resources/checks/v3/examples/OAR031/allof-schema.yaml
@@ -0,0 +1,33 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ schemas:
+ BaseEntity:
+ type: object
+ properties:
+ id:
+ type: integer
+ example: 1
+ Pet:
+ allOf:
+ - $ref: '#/components/schemas/BaseEntity'
+ properties:
+ name:
+ type: string
+ example: "Fluffy"
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ example:
+ name: Fluffy
+ 204:
+ description: No content
diff --git a/src/test/resources/checks/v3/format/OAR037/complete.json b/src/test/resources/checks/v3/format/OAR037/complete.json
index dfefdf0b..b9e6416d 100644
--- a/src/test/resources/checks/v3/format/OAR037/complete.json
+++ b/src/test/resources/checks/v3/format/OAR037/complete.json
@@ -54,7 +54,7 @@
"type": "object",
"properties": {
"without": {
- "type": "string"
+ "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
},
"date": {
"type": "string",
diff --git a/src/test/resources/checks/v3/format/OAR037/complete.yaml b/src/test/resources/checks/v3/format/OAR037/complete.yaml
index 2e7b6f3f..2120e544 100644
--- a/src/test/resources/checks/v3/format/OAR037/complete.yaml
+++ b/src/test/resources/checks/v3/format/OAR037/complete.yaml
@@ -37,7 +37,7 @@ paths:
type: object
properties:
without:
- type: string
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
date:
type: string
format: date
diff --git a/src/test/resources/checks/v3/format/OAR051/different-description.json b/src/test/resources/checks/v3/format/OAR051/different-description.json
index 784c6b8b..2c1e4b1e 100644
--- a/src/test/resources/checks/v3/format/OAR051/different-description.json
+++ b/src/test/resources/checks/v3/format/OAR051/different-description.json
@@ -8,7 +8,8 @@
"/pets" : {
"post" : {
"summary" : "create a pet",
- "description" : "Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other operations.",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "Create a pet",
"responses" : {
"default" : {
"description" : "the default response"
diff --git a/src/test/resources/checks/v3/format/OAR051/different-description.yaml b/src/test/resources/checks/v3/format/OAR051/different-description.yaml
index 600efaff..33a87e0d 100644
--- a/src/test/resources/checks/v3/format/OAR051/different-description.yaml
+++ b/src/test/resources/checks/v3/format/OAR051/different-description.yaml
@@ -6,8 +6,8 @@ paths:
/pets:
post:
summary: create a pet
- description: Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other
- operations.
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: Create a pet
responses:
default:
description: the default response
diff --git a/src/test/resources/checks/v3/format/OAR066/snake-case-error.json b/src/test/resources/checks/v3/format/OAR066/snake-case-error.json
index 5362c7f2..38d6d4af 100644
--- a/src/test/resources/checks/v3/format/OAR066/snake-case-error.json
+++ b/src/test/resources/checks/v3/format/OAR066/snake-case-error.json
@@ -14,7 +14,13 @@
"type": "object",
"properties": {
"firstName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
- "last_name": { "type": "string" }
+ "last_name": {
+ "type": "object",
+ "properties": {
+ "streetName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "street_name": { "type": "string" }
+ }
+ }
}
}
}
@@ -29,7 +35,13 @@
"type": "object",
"properties": {
"userID": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
- "user_name": { "type": "string" }
+ "user_name": {
+ "type": "object",
+ "properties": {
+ "userId": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "user_id": { "type": "integer" }
+ }
+ }
}
}
}
diff --git a/src/test/resources/checks/v3/format/OAR066/snake-case-error.yaml b/src/test/resources/checks/v3/format/OAR066/snake-case-error.yaml
index 6bf327fb..089ff7b5 100644
--- a/src/test/resources/checks/v3/format/OAR066/snake-case-error.yaml
+++ b/src/test/resources/checks/v3/format/OAR066/snake-case-error.yaml
@@ -14,7 +14,12 @@ paths:
firstName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
type: string
last_name:
- type: string
+ type: object
+ properties:
+ streetName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ street_name:
+ type: string
responses:
'200':
description: Success
@@ -26,4 +31,9 @@ paths:
userID: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
type: integer
user_name:
- type: string
\ No newline at end of file
+ type: object
+ properties:
+ userId: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_id:
+ type: integer
\ No newline at end of file
diff --git a/src/test/resources/checks/v3/format/OAR066/valid.json b/src/test/resources/checks/v3/format/OAR066/valid.json
index 67217b92..302ebdaf 100644
--- a/src/test/resources/checks/v3/format/OAR066/valid.json
+++ b/src/test/resources/checks/v3/format/OAR066/valid.json
@@ -13,7 +13,13 @@
"schema": {
"type": "object",
"properties": {
- "last_name": { "type": "string" }
+ "last_name": { "type": "string" },
+ "_links": { "type": "object" },
+ "_embedded": { "type": "object" },
+ "@context": { "type": "string" },
+ "@type": { "type": "string" },
+ "@id": { "type": "string" },
+ "x-internal": { "type": "boolean" }
}
}
}
diff --git a/src/test/resources/checks/v3/format/OAR066/valid.yaml b/src/test/resources/checks/v3/format/OAR066/valid.yaml
index 04c50530..e0118af0 100644
--- a/src/test/resources/checks/v3/format/OAR066/valid.yaml
+++ b/src/test/resources/checks/v3/format/OAR066/valid.yaml
@@ -13,6 +13,18 @@ paths:
properties:
last_name:
type: string
+ _links:
+ type: object
+ _embedded:
+ type: object
+ "@context":
+ type: string
+ "@type":
+ type: string
+ "@id":
+ type: string
+ x-internal:
+ type: boolean
responses:
'200':
description: Success
diff --git a/src/test/resources/checks/v3/operations/OAR017/plain.json b/src/test/resources/checks/v3/operations/OAR017/plain.json
index 1c9602cb..fa47610d 100644
--- a/src/test/resources/checks/v3/operations/OAR017/plain.json
+++ b/src/test/resources/checks/v3/operations/OAR017/plain.json
@@ -5,50 +5,45 @@
"title" : "Swagger Petstore"
},
"paths" : {
- "/one/me" : { # Noncompliant {{OAR017: Pattern 'me' not allowed}}
+ "/{one}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
"get" : {
- "responses" : {
- "200" : {
- "description" : "Ok"
- }
- }
+ "responses" : { "200" : { "description" : "Ok" } }
}
},
- "/{one}" : {
+ "/one/two" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
"get" : {
- "responses" : {
- "200" : {
- "description" : "Ok"
- }
- }
+ "responses" : { "200" : { "description" : "Ok" } }
}
},
- "/one/two" : {
+ "/one/me" : {
"get" : {
- "responses" : {
- "200" : {
- "description" : "Ok"
- }
- }
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/me/three" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
}
},
"/one/{two}" : {
"get" : {
- "responses" : {
- "200" : {
- "description" : "Ok"
- }
- }
+ "responses" : { "200" : { "description" : "Ok" } }
}
},
"/one/{two}/three" : {
"get" : {
- "responses" : {
- "200" : {
- "description" : "Ok"
- }
- }
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}/{three}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/me/items/{id}" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/checks/v3/operations/OAR017/plain.yaml b/src/test/resources/checks/v3/operations/OAR017/plain.yaml
index e1d0c120..d902e89e 100644
--- a/src/test/resources/checks/v3/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v3/operations/OAR017/plain.yaml
@@ -3,17 +3,22 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /one/me: # Noncompliant {{OAR017: Pattern 'me' not allowed}}
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
get:
responses:
200:
description: Ok
- /{one}:
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
get:
responses:
200:
description: Ok
- /one/two:
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/me/three:
get:
responses:
200:
@@ -27,4 +32,14 @@ paths:
get:
responses:
200:
- description: Ok
\ No newline at end of file
+ description: Ok
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v3/operations/OAR038/valid-with-error.json b/src/test/resources/checks/v3/operations/OAR038/valid-with-error.json
new file mode 100644
index 00000000..ffa93065
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR038/valid-with-error.json
@@ -0,0 +1,32 @@
+{
+ "openapi": "3.0.0",
+ "info": { "version": "1.0.0", "title": "Swagger Petstore" },
+ "paths": {
+ "/endpoint": {
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Ok",
+ "content": {
+ "application/json": { "schema": { "$ref": "#/components/schemas/response" } }
+ }
+ },
+ "204": { "description": "No content" }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": { "message": { "type": "string" } }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/operations/OAR038/valid-with-error.yaml b/src/test/resources/checks/v3/operations/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..7f162351
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.json b/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..673a756f
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..ddfcbfac
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v3/operations/OAR038/without-data.json b/src/test/resources/checks/v3/operations/OAR038/without-data.json
index a6d5f9a6..dde773ef 100644
--- a/src/test/resources/checks/v3/operations/OAR038/without-data.json
+++ b/src/test/resources/checks/v3/operations/OAR038/without-data.json
@@ -27,7 +27,7 @@
},
"components": {
"schemas" : {
- "response" : { # Noncompliant {{OAR038: 'data' property is missing}}
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
"type" : "object"
}
}
diff --git a/src/test/resources/checks/v3/operations/OAR038/without-data.yaml b/src/test/resources/checks/v3/operations/OAR038/without-data.yaml
index b64463dd..f3cefdaa 100644
--- a/src/test/resources/checks/v3/operations/OAR038/without-data.yaml
+++ b/src/test/resources/checks/v3/operations/OAR038/without-data.yaml
@@ -17,5 +17,5 @@ paths:
components:
schemas:
- response: # Noncompliant {{OAR038: 'data' property is missing}}
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v3/operations/OAR045/defined-response.json b/src/test/resources/checks/v3/operations/OAR045/defined-response.json
new file mode 100644
index 00000000..f86d6ac4
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/operations/OAR045/defined-response.yaml b/src/test/resources/checks/v3/operations/OAR045/defined-response.yaml
new file mode 100644
index 00000000..4370ac6c
--- /dev/null
+++ b/src/test/resources/checks/v3/operations/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: 3.0.0
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.json b/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.json
new file mode 100644
index 00000000..8e1fc58e
--- /dev/null
+++ b/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.json
@@ -0,0 +1,57 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Health Check Excluded Paths API"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Health check - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health": {
+ "get": {
+ "summary": "Health endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health-check": {
+ "get": {
+ "summary": "Health check endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/ping": {
+ "get": {
+ "summary": "Ping endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/liveness": {
+ "get": {
+ "summary": "Liveness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/readiness": {
+ "get": {
+ "summary": "Readiness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.yaml b/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.yaml
new file mode 100644
index 00000000..b114cdb8
--- /dev/null
+++ b/src/test/resources/checks/v3/owasp/OAR073/health-check-excluded.yaml
@@ -0,0 +1,41 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Health Check Excluded Paths API
+paths:
+ /status:
+ get:
+ summary: Health check - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health:
+ get:
+ summary: Health endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health-check:
+ get:
+ summary: Health check endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /ping:
+ get:
+ summary: Ping endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /liveness:
+ get:
+ summary: Liveness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /readiness:
+ get:
+ summary: Readiness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.json b/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.json
new file mode 100644
index 00000000..9c39cc06
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "expand",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.yaml b/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.yaml
new file mode 100644
index 00000000..a15bae06
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR020/expand-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.json b/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.json
new file mode 100644
index 00000000..33a8e94d
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "exclude",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.yaml b/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.yaml
new file mode 100644
index 00000000..cda8d1ad
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR021/exclude-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR028/components-param.json b/src/test/resources/checks/v3/parameters/OAR028/components-param.json
index 38b3f30a..8e540684 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/components-param.json
+++ b/src/test/resources/checks/v3/parameters/OAR028/components-param.json
@@ -8,7 +8,7 @@
"parameters" : {
"filterParam" : {
"in" : "query",
- "name" : "other",
+ "name" : "$filter",
"schema" : {
"type" : "string"
}
@@ -18,6 +18,9 @@
"paths" : {
"/examples" : {
"get" : {
+ "parameters" : [
+ { "$ref" : "#/components/parameters/filterParam" }
+ ],
"responses" : {
"200" : {
"description" : "Ok"
diff --git a/src/test/resources/checks/v3/parameters/OAR028/components-param.yaml b/src/test/resources/checks/v3/parameters/OAR028/components-param.yaml
index 18bc4ac4..a553d250 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/components-param.yaml
+++ b/src/test/resources/checks/v3/parameters/OAR028/components-param.yaml
@@ -6,12 +6,14 @@ components:
parameters:
filterParam:
in: query
- name: other
+ name: $filter
schema:
type: string
paths:
/examples:
get:
+ parameters:
+ - $ref: '#/components/parameters/filterParam'
responses:
200:
description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.json b/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.json
index ec73f987..67435d01 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.json
+++ b/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.json
@@ -5,11 +5,11 @@
"title" : "Swagger Petstore"
},
"paths" : {
- "/status" : {
- "get" : {
+ "/orders" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
"parameters" : [ {
"in" : "query",
- "name" : "other", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "other",
"schema" : {
"type" : "array",
"items" : {
@@ -18,7 +18,7 @@
}
}, {
"in" : "query",
- "name" : "select", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "select",
"schema" : {
"type" : "array",
"items" : {
diff --git a/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.yaml b/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.yaml
index bc7139de..0d212700 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.yaml
+++ b/src/test/resources/checks/v3/parameters/OAR028/exclude-noncompliant.yaml
@@ -3,17 +3,17 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /status:
- get:
+ /orders:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
parameters:
- in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
schema:
type: array
items:
type: string
- in: query
- name: select # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: select
schema:
type: array
items:
diff --git a/src/test/resources/checks/v3/parameters/OAR028/header-ignored.json b/src/test/resources/checks/v3/parameters/OAR028/header-ignored.json
new file mode 100644
index 00000000..e981b6e3
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR028/header-ignored.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "header",
+ "name" : "Authorization",
+ "schema" : {
+ "type" : "string"
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR028/header-ignored.yaml b/src/test/resources/checks/v3/parameters/OAR028/header-ignored.yaml
new file mode 100644
index 00000000..eebe9721
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR028/header-ignored.yaml
@@ -0,0 +1,21 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: header
+ name: Authorization
+ schema:
+ type: string
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.json b/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.json
new file mode 100644
index 00000000..a257ab40
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "post" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me/settings" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/health" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/ping" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.yaml b/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.yaml
new file mode 100644
index 00000000..495e15e9
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR028/me-health-ping.yaml
@@ -0,0 +1,35 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ post:
+ responses:
+ 206:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me/settings:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /health:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /ping:
+ get:
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR028/plain-without.json b/src/test/resources/checks/v3/parameters/OAR028/plain-without.json
index 56ec4af2..d1b165a9 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/plain-without.json
+++ b/src/test/resources/checks/v3/parameters/OAR028/plain-without.json
@@ -6,10 +6,10 @@
},
"paths" : {
"/examples" : {
- "get" : {
- "parameters" : [ {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
"in" : "query",
- "name" : "other", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "other",
"schema": {
"type" : "array",
"items" : {
@@ -18,7 +18,7 @@
}
}, {
"in" : "query",
- "name" : "select", # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "name" : "select",
"schema": {
"type" : "array",
"items" : {
@@ -34,4 +34,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR028/plain-without.yaml b/src/test/resources/checks/v3/parameters/OAR028/plain-without.yaml
index e756f798..ddafd313 100644
--- a/src/test/resources/checks/v3/parameters/OAR028/plain-without.yaml
+++ b/src/test/resources/checks/v3/parameters/OAR028/plain-without.yaml
@@ -4,20 +4,20 @@ info:
title: Swagger Petstore
paths:
/examples:
- get:
- parameters:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
- in: query
- name: other # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: other
schema:
type: array
items:
type: string
- in: query
- name: select # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ name: select
schema:
type: array
items:
type: string
responses:
206:
- description: Ok
\ No newline at end of file
+ description: Ok
diff --git a/src/test/resources/checks/v3/resources/OAR017/plain.yaml b/src/test/resources/checks/v3/resources/OAR017/plain.yaml
index 29c02541..f872fa73 100644
--- a/src/test/resources/checks/v3/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v3/resources/OAR017/plain.yaml
@@ -49,4 +49,10 @@ paths:
get:
responses:
200:
- description: Ok
\ No newline at end of file
+ description: Ok
+
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v3/resources/OAR038/valid-with-error.json b/src/test/resources/checks/v3/resources/OAR038/valid-with-error.json
new file mode 100644
index 00000000..89ed754d
--- /dev/null
+++ b/src/test/resources/checks/v3/resources/OAR038/valid-with-error.json
@@ -0,0 +1 @@
+{"openapi":"3.0.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}
diff --git a/src/test/resources/checks/v3/resources/OAR038/valid-with-error.yaml b/src/test/resources/checks/v3/resources/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..7f162351
--- /dev/null
+++ b/src/test/resources/checks/v3/resources/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.json b/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..6380046b
--- /dev/null
+++ b/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.json
@@ -0,0 +1,2 @@
+{"openapi":"3.0.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type":"object","properties":{"id":{"type":"string"}}}}}}}}}
diff --git a/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..ddfcbfac
--- /dev/null
+++ b/src/test/resources/checks/v3/resources/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v3/resources/OAR038/without-data.json b/src/test/resources/checks/v3/resources/OAR038/without-data.json
index a6d5f9a6..dde773ef 100644
--- a/src/test/resources/checks/v3/resources/OAR038/without-data.json
+++ b/src/test/resources/checks/v3/resources/OAR038/without-data.json
@@ -27,7 +27,7 @@
},
"components": {
"schemas" : {
- "response" : { # Noncompliant {{OAR038: 'data' property is missing}}
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
"type" : "object"
}
}
diff --git a/src/test/resources/checks/v3/resources/OAR038/without-data.yaml b/src/test/resources/checks/v3/resources/OAR038/without-data.yaml
index b64463dd..f3cefdaa 100644
--- a/src/test/resources/checks/v3/resources/OAR038/without-data.yaml
+++ b/src/test/resources/checks/v3/resources/OAR038/without-data.yaml
@@ -17,5 +17,5 @@ paths:
components:
schemas:
- response: # Noncompliant {{OAR038: 'data' property is missing}}
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v3/security/OAR045/defined-response.json b/src/test/resources/checks/v3/security/OAR045/defined-response.json
new file mode 100644
index 00000000..f86d6ac4
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/security/OAR045/defined-response.yaml b/src/test/resources/checks/v3/security/OAR045/defined-response.yaml
new file mode 100644
index 00000000..4370ac6c
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: 3.0.0
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v3/security/OAR053/excluded-code.json b/src/test/resources/checks/v3/security/OAR053/excluded-code.json
new file mode 100644
index 00000000..619f4f86
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/excluded-code.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No Content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/security/OAR053/excluded-code.yaml b/src/test/resources/checks/v3/security/OAR053/excluded-code.yaml
new file mode 100644
index 00000000..a02d35b0
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/excluded-code.yaml
@@ -0,0 +1,11 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ delete:
+ responses:
+ '204':
+ description: No Content
diff --git a/src/test/resources/checks/v3/security/OAR053/excluded-path.json b/src/test/resources/checks/v3/security/OAR053/excluded-path.json
new file mode 100644
index 00000000..54d786d9
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/excluded-path.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/security/OAR053/excluded-path.yaml b/src/test/resources/checks/v3/security/OAR053/excluded-path.yaml
new file mode 100644
index 00000000..18f1d53e
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/excluded-path.yaml
@@ -0,0 +1,11 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /status:
+ get:
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v3/security/OAR053/forbidden-header.json b/src/test/resources/checks/v3/security/OAR053/forbidden-header.json
new file mode 100644
index 00000000..e17d6b8f
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/forbidden-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-forbidden-custom-header": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/security/OAR053/forbidden-header.yaml b/src/test/resources/checks/v3/security/OAR053/forbidden-header.yaml
new file mode 100644
index 00000000..ea8ae055
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/forbidden-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ x-forbidden-custom-header:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v3/security/OAR053/missing-header.json b/src/test/resources/checks/v3/security/OAR053/missing-header.json
new file mode 100644
index 00000000..bd00e3ba
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/missing-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "idCorrelacion": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/security/OAR053/missing-header.yaml b/src/test/resources/checks/v3/security/OAR053/missing-header.yaml
new file mode 100644
index 00000000..5ef9c5cf
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR053/missing-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ idCorrelacion:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v3/security/OAR085/truly-invalid.json b/src/test/resources/checks/v3/security/OAR085/truly-invalid.json
new file mode 100644
index 00000000..e7637d72
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR085/truly-invalid.json
@@ -0,0 +1,9 @@
+{
+ "openapi": "4.0.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API with an invalid openapi version.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
diff --git a/src/test/resources/checks/v3/security/OAR085/truly-invalid.yaml b/src/test/resources/checks/v3/security/OAR085/truly-invalid.yaml
new file mode 100644
index 00000000..d9dbb374
--- /dev/null
+++ b/src/test/resources/checks/v3/security/OAR085/truly-invalid.yaml
@@ -0,0 +1,6 @@
+openapi: "4.0.0"
+info:
+ title: Sample API
+ description: This is a sample API with an invalid openapi version.
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.json b/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.json
new file mode 100644
index 00000000..86dd3681
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ ] # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.yaml b/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.yaml
new file mode 100644
index 00000000..05a0c109
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-empty-scopes.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes: [] # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.json b/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.json
new file mode 100644
index 00000000..951533cb
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : null # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.yaml b/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.yaml
new file mode 100644
index 00000000..d61474e7
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-null-scopes.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes: null # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-scopes.json b/src/test/resources/checks/v31/apim/OAR002/with-scopes.json
new file mode 100644
index 00000000..807c5ce0
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-scopes.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ { # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ "name" : "read",
+ "roles" : "ROLE_READ"
+ }, { # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ "name" : "write",
+ "key" : "write"
+ }, { # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ "key" : "view",
+ "roles" : "ROLE_VIEW"
+ }, {
+ "name" : "read2",
+ "roles" : "ROLE_READ_2",
+ "key" : null # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ }, {
+ "name" : "write2",
+ "key" : "write2",
+ "roles" : null # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ }, {
+ "key" : "view2",
+ "roles" : "ROLE_VIEW_2",
+ "name" : null # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/with-scopes.yaml b/src/test/resources/checks/v31/apim/OAR002/with-scopes.yaml
new file mode 100644
index 00000000..3c78c8ee
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/with-scopes.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ roles: ROLE_READ
+ - name: write # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ key: write
+ - key: view # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ roles: ROLE_VIEW
+ - name: read2
+ roles: ROLE_READ_2
+ key: null # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ - name: write2
+ key: write2
+ roles: null # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ - key: view2
+ roles: ROLE_VIEW_2
+ name: null # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/without-scopes.json b/src/test/resources/checks/v31/apim/OAR002/without-scopes.json
new file mode 100644
index 00000000..ef8e7c9f
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/without-scopes.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : null
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/without-scopes.yaml b/src/test/resources/checks/v31/apim/OAR002/without-scopes.yaml
new file mode 100644
index 00000000..1122903d
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/without-scopes.yaml
@@ -0,0 +1,9 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim: null
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/without-security.json b/src/test/resources/checks/v31/apim/OAR002/without-security.json
new file mode 100644
index 00000000..f33ac2ec
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/without-security.json
@@ -0,0 +1,10 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR002/without-security.yaml b/src/test/resources/checks/v31/apim/OAR002/without-security.yaml
new file mode 100644
index 00000000..5f9407a2
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR002/without-security.yaml
@@ -0,0 +1,6 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/with-description.json b/src/test/resources/checks/v31/apim/OAR003/with-description.json
new file mode 100644
index 00000000..a413fbdc
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/with-description.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ",
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/with-description.yaml b/src/test/resources/checks/v31/apim/OAR003/with-description.yaml
new file mode 100644
index 00000000..a985339a
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/with-description.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/with-null-description.json b/src/test/resources/checks/v31/apim/OAR003/with-null-description.json
new file mode 100644
index 00000000..5f3dde3d
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/with-null-description.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ",
+ "description" : null # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/with-null-description.yaml b/src/test/resources/checks/v31/apim/OAR003/with-null-description.yaml
new file mode 100644
index 00000000..6c14ec1c
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/with-null-description.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ
+ description: null # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/without-description.json b/src/test/resources/checks/v31/apim/OAR003/without-description.json
new file mode 100644
index 00000000..f2dbc4eb
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/without-description.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ { # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR003/without-description.yaml b/src/test/resources/checks/v31/apim/OAR003/without-description.yaml
new file mode 100644
index 00000000..d19fc16f
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR003/without-description.yaml
@@ -0,0 +1,13 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ key: read
+ roles: ROLE_READ
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.json b/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.json
new file mode 100644
index 00000000..8d4da38a
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROL€_V¡€U" ], # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.yaml b/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.yaml
new file mode 100644
index 00000000..ba79bbe6
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-invalid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.json b/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.json
new file mode 100644
index 00000000..6d2e1cb8
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ, ROL€_V¡€U", # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.yaml b/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.yaml
new file mode 100644
index 00000000..0f470c00
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-invalid-roles.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ, ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.json b/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.json
new file mode 100644
index 00000000..60b81451
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROLE_VIEW" ],
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.yaml b/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.yaml
new file mode 100644
index 00000000..8db7ca63
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-valid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROLE_VIEW
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.json b/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.json
new file mode 100644
index 00000000..c3941d96
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ, ROLE_VIEW",
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.yaml b/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.yaml
new file mode 100644
index 00000000..9cab865c
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR004/with-valid-roles.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ, ROLE_VIEW
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.json b/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.json
new file mode 100644
index 00000000..db247ec0
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two"
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.yaml b/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.yaml
new file mode 100644
index 00000000..c133f505
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-correct-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.json b/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.json
new file mode 100644
index 00000000..0857015b
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : null # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.yaml b/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.yaml
new file mode 100644
index 00000000..456fbe2f
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-null-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: null # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.json b/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.json
new file mode 100644
index 00000000..b497904f
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_five" # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two, role_x"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.yaml b/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.yaml
new file mode 100644
index 00000000..edd510b9
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR005/with-wrong-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_five # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two, role_x
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR040/invalid.json b/src/test/resources/checks/v31/apim/OAR040/invalid.json
new file mode 100644
index 00000000..802839a0
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR040/invalid.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "app" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "app1_sc_ran" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "GENE_Sc_ran" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "X_SC_A" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR040/invalid.yaml b/src/test/resources/checks/v31/apim/OAR040/invalid.yaml
new file mode 100644
index 00000000..0f445609
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR040/invalid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: app # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: app1_sc_ran # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: GENE_Sc_ran # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: X_SC_A # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR040/valid.json b/src/test/resources/checks/v31/apim/OAR040/valid.json
new file mode 100644
index 00000000..4b5ebfe5
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR040/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "xfcn_sc_1"
+ }, {
+ "name" : "GENGA_SC_RE1"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR040/valid.yaml b/src/test/resources/checks/v31/apim/OAR040/valid.yaml
new file mode 100644
index 00000000..7de6120f
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR040/valid.yaml
@@ -0,0 +1,12 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: xfcn_sc_1
+ - name: GENGA_SC_RE1
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.json b/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.json
new file mode 100644
index 00000000..a9ecb0a2
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two",
+ "x-auth-type" : "Application"
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.yaml b/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.yaml
new file mode 100644
index 00000000..740a0852
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/with-scope-and-auth.yaml
@@ -0,0 +1,24 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two
+ x-auth-type: "Application"
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.json b/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.json
new file mode 100644
index 00000000..dbca04d4
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two" # Noncompliant {{OAR041: WSO2 x-scope requires x-auth-type definition}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.yaml b/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.yaml
new file mode 100644
index 00000000..833dd710
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/with-scope-without-auth.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two # Noncompliant {{OAR041: WSO2 x-scope requires x-auth-type definition}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.json b/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.json
new file mode 100644
index 00000000..3eb83d1d
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.yaml b/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.yaml
new file mode 100644
index 00000000..c25eabfc
--- /dev/null
+++ b/src/test/resources/checks/v31/apim/OAR041/without-scope-and-auth.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR044/media-type.json b/src/test/resources/checks/v31/core/OAR044/media-type.json
new file mode 100644
index 00000000..938aab91
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR044/media-type.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "requestBody" : {
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ "text/*" : { }
+ }
+ },
+ "responses" : {
+ "200" : {
+ "description" : "some operation",
+ "content" : {
+ "application" : { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ }
+ }
+ },
+ "parameters" : [ {
+ "name" : "someParam",
+ "in" : "query",
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ "text/plain" : { }
+ }
+ }, {
+ "name" : "otherParam",
+ "in" : "path"
+ } ]
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "some operation"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR044/media-type.yaml b/src/test/resources/checks/v31/core/OAR044/media-type.yaml
new file mode 100644
index 00000000..67d72d30
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR044/media-type.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ requestBody:
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+# ^^^^^^^^^^^^^
+ 'text/*': {}
+ responses:
+ '200':
+ description: some operation
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ parameters:
+ - name: someParam
+ in: query
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ 'text/plain': {} # invalid (only 1 content allowed by spec), but should not be caught by this rule
+ - name: otherParam
+ in: path
+ post:
+ responses:
+ '200':
+ description: some operation
diff --git a/src/test/resources/checks/v31/core/OAR045/defined-response.json b/src/test/resources/checks/v31/core/OAR045/defined-response.json
new file mode 100644
index 00000000..b73d9c78
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/core/OAR045/defined-response.yaml b/src/test/resources/checks/v31/core/OAR045/defined-response.yaml
new file mode 100644
index 00000000..6540560a
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v31/core/OAR046/declared-tag.json b/src/test/resources/checks/v31/core/OAR046/declared-tag.json
new file mode 100644
index 00000000..ba269228
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR046/declared-tag.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag" ],
+ "responses" : { }
+ },
+ "post" : { # Noncompliant {{OAR046: Associate a tag to this operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR046/declared-tag.yaml b/src/test/resources/checks/v31/core/OAR046/declared-tag.yaml
new file mode 100644
index 00000000..ad2e2943
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR046/declared-tag.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ responses: {}
+ post: # Noncompliant {{OAR046: Associate a tag to this operation}}
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR047/documented-tag.json b/src/test/resources/checks/v31/core/OAR047/documented-tag.json
new file mode 100644
index 00000000..699a856b
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR047/documented-tag.json
@@ -0,0 +1,24 @@
+{
+ "openapi" : "3.1.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ }, {
+ "name" : "undescribed-tag" # Noncompliant {{OAR047: Add a short description to this tag}}
+ }, {
+ "name" : "used-tag", # Noncompliant [[secondary=-3]] {{OAR047: Remove this duplicate tag}}
+ "description" : "another description"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag", "undescribed-tag", "unlisted-tag" ], # Noncompliant {{OAR047: This tag should be declared in the tags section of the contract}}
+ "responses" : { }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR047/documented-tag.yaml b/src/test/resources/checks/v31/core/OAR047/documented-tag.yaml
new file mode 100644
index 00000000..561e6f15
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR047/documented-tag.yaml
@@ -0,0 +1,18 @@
+openapi: "3.1.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+- name: undescribed-tag # Noncompliant {{OAR047: Add a short description to this tag}}
+- name: used-tag # Noncompliant [[secondary=-3]] {{OAR047: Remove this duplicate tag}}
+ description: another description
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ - undescribed-tag
+ - unlisted-tag # Noncompliant {{OAR047: This tag should be declared in the tags section of the contract}}
+ responses: {}
diff --git a/src/test/resources/checks/v31/core/OAR049/no-content-in-204.json b/src/test/resources/checks/v31/core/OAR049/no-content-in-204.json
new file mode 100644
index 00000000..dcfe19fe
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR049/no-content-in-204.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/other-pets/{petId}" : {
+ "delete" : {
+ "responses" : {
+ "204" : { # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ "description" : "delete pet",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "type" : "object"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR049/no-content-in-204.yaml b/src/test/resources/checks/v31/core/OAR049/no-content-in-204.yaml
new file mode 100644
index 00000000..6f13e302
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR049/no-content-in-204.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /other-pets/{petId}:
+ delete:
+ responses:
+ '204': # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ description: delete pet
+ content:
+ 'application/json':
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v31/core/OAR050/provide-summary.json b/src/test/resources/checks/v31/core/OAR050/provide-summary.json
new file mode 100644
index 00000000..8d2ea1b5
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR050/provide-summary.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : { # Noncompliant {{OAR050: Provide a summary for each operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR050/provide-summary.yaml b/src/test/resources/checks/v31/core/OAR050/provide-summary.yaml
new file mode 100644
index 00000000..b523fda2
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR050/provide-summary.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR050: Provide a summary for each operation}}
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR051/different-description.json b/src/test/resources/checks/v31/core/OAR051/different-description.json
new file mode 100644
index 00000000..976500ed
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR051/different-description.json
@@ -0,0 +1,30 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "summary" : "create a pet",
+ "description" : "Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other operations.",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "List all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/core/OAR051/different-description.yaml b/src/test/resources/checks/v31/core/OAR051/different-description.yaml
new file mode 100644
index 00000000..cb97cd8f
--- /dev/null
+++ b/src/test/resources/checks/v31/core/OAR051/different-description.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ summary: create a pet
+ description: Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other
+ operations.
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: List all pets
+# ^^^^^^^^^^^
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR031/allof-schema.json b/src/test/resources/checks/v31/examples/OAR031/allof-schema.json
new file mode 100644
index 00000000..0155d35a
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/allof-schema.json
@@ -0,0 +1,55 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components" : {
+ "schemas" : {
+ "BaseEntity" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "integer",
+ "example" : 1
+ }
+ }
+ },
+ "Pet" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/BaseEntity"
+ } ],
+ "properties" : {
+ "name" : {
+ "type" : "string",
+ "example" : "Fluffy"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/Pet"
+ },
+ "example" : {
+ "name" : "Fluffy"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/examples/OAR031/allof-schema.yaml b/src/test/resources/checks/v31/examples/OAR031/allof-schema.yaml
new file mode 100644
index 00000000..771b7e0d
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/allof-schema.yaml
@@ -0,0 +1,33 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ schemas:
+ BaseEntity:
+ type: object
+ properties:
+ id:
+ type: integer
+ example: 1
+ Pet:
+ allOf:
+ - $ref: '#/components/schemas/BaseEntity'
+ properties:
+ name:
+ type: string
+ example: "Fluffy"
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ example:
+ name: Fluffy
+ 204:
+ description: No content
diff --git a/src/test/resources/checks/v31/examples/OAR031/externalref.yaml b/src/test/resources/checks/v31/examples/OAR031/externalref.yaml
new file mode 100644
index 00000000..21cee27e
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/externalref.yaml
@@ -0,0 +1,68 @@
+openapi: "3.1.0"
+info:
+ title: Example API
+ description: This is a basic example of an OpenAPI document.
+ version: 1.0.0
+servers:
+ - url: https://api.example.com/v1
+ description: Main (production) server
+ - url: https://api.staging.example.com
+ description: Staging server
+paths:
+ /users:
+ get:
+ summary: Get all users
+ description: Returns a list of users.
+ responses:
+ '200':
+ description: A JSON array of user objects
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ '400':
+ $ref: >- # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ http://localhost:18089/OAR031.yaml#/components/responses/server_error_response
+ /users/{userId}:
+ get:
+ summary: Get a user by ID
+ description: Returns a single user.
+ parameters:
+ - name: userId
+ in: path
+ required: true
+ description: The ID of the user to retrieve
+ schema:
+ type: string
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ '200':
+ description: A single user object
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ $ref: >- # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ http://localhost:18089/OAR031.yaml#/components/responses/server_error_response
+components:
+ schemas:
+ User:
+ type: object
+ required:
+ - id
+ - name
+ properties:
+ id:
+ type: string
+ example: '12345'
+ name:
+ type: string
+ example: 'John Doe'
+ email:
+ type: string
+ example: 'john.doe@example.com'
diff --git a/src/test/resources/checks/v31/examples/OAR031/nested-properties-examples.yaml b/src/test/resources/checks/v31/examples/OAR031/nested-properties-examples.yaml
new file mode 100644
index 00000000..bf96e975
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/nested-properties-examples.yaml
@@ -0,0 +1,39 @@
+openapi: "3.1.0"
+info:
+ title: OAR031 Nested Examples
+ version: 1.0.0
+paths:
+ /profile:
+ put:
+ summary: Update user profile
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ email:
+ type: string
+ example: "apellido@madrid.org"
+ telefono_fijo:
+ type: string
+ example: "600345345"
+ direccion:
+ type: object
+ properties:
+ calle:
+ type: string
+ example: "Calle Indeterminada, 18"
+ localidad:
+ type: string
+ example: "Madrid"
+ provincia:
+ type: string
+ example: "Madrid"
+ codigo_postal:
+ type: string
+ example: "28001"
+ responses:
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR031/valid.json b/src/test/resources/checks/v31/examples/OAR031/valid.json
new file mode 100644
index 00000000..403837e3
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/valid.json
@@ -0,0 +1,170 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ },
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Pet created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ },
+ "example": {
+ "size": 2,
+ "pets": [
+ {
+ "name": "Fluffy",
+ "type": "cat"
+ },
+ {
+ "name": "Sparky",
+ "type": "dog"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Fluffy",
+ "type": "cat"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true,
+ "example": 513168138
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "Snow"
+ },
+ "type": {
+ "type": "string",
+ "example": "dog"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": {
+ "type": "integer",
+ "example": 1
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": {
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "example": "Server error"
+ }
+ }
+ },
+ "example": {
+ "error": "Server error"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR031/valid.yaml b/src/test/resources/checks/v31/examples/OAR031/valid.yaml
new file mode 100644
index 00000000..9b68a04e
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/valid.yaml
@@ -0,0 +1,113 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ 201:
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pet'
+ example:
+ name: Puppy
+ type: dog
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+ get:
+ responses:
+ 204:
+ description: No content
+ 206:
+ description: Pet created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ example:
+ size: 2
+ pets:
+ - name: Fluffy
+ type: cat
+ - name: Sparky
+ type: dog
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200:
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Fluffy
+ type: cat
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ example: 513168138
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+
+ schemas:
+ pet:
+ type: object
+ properties:
+ name:
+ type: string
+ example: "Snow"
+ type:
+ type: string
+ example: "dog"
+ pets:
+ type: object
+ properties:
+ size:
+ type: integer
+ example: 1
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error:
+ type: string
+ example: "Server error"
+ example:
+ error: "Server error"
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR031/without-examples.json b/src/test/resources/checks/v31/examples/OAR031/without-examples.json
new file mode 100644
index 00000000..706de65f
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/without-examples.json
@@ -0,0 +1,120 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "parameters": [
+ { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "query",
+ "name": "$start",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ },
+ "type": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "integer"
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR031/without-examples.yaml b/src/test/resources/checks/v31/examples/OAR031/without-examples.yaml
new file mode 100644
index 00000000..5fa170e9
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR031/without-examples.yaml
@@ -0,0 +1,73 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ parameters:
+ - in: query # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: $start
+ schema:
+ type: integer
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+ schemas:
+ pet:
+ type: object
+ properties:
+ name: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ type: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ pets:
+ type: object
+ properties:
+ size: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: integer
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR094/externalref.yaml b/src/test/resources/checks/v31/examples/OAR094/externalref.yaml
new file mode 100644
index 00000000..f0a660ef
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR094/externalref.yaml
@@ -0,0 +1,62 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR094.yaml#/components/schemas/Pet
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR094.yaml#/components/schemas/ErrorMessage
+ example: # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR094/invalid-example.json b/src/test/resources/checks/v31/examples/OAR094/invalid-example.json
new file mode 100644
index 00000000..b1d91b67
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR094/invalid-example.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API con Example",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Devuelve una lista de mascotas",
+ "responses": {
+ "200": {
+ "description": "Lista exitosa de mascotas",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ },
+ "example": [ # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ {
+ "name": "Whiskers",
+ "animalType": "Cat"
+ },
+ {
+ "name": "Daisy",
+ "animalType": "Dog"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "animalType": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR094/invalid-example.yaml b/src/test/resources/checks/v31/examples/OAR094/invalid-example.yaml
new file mode 100644
index 00000000..b999a5a3
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR094/invalid-example.yaml
@@ -0,0 +1,31 @@
+openapi: "3.1.0"
+info:
+ title: API con Example
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Devuelve una lista de mascotas
+ responses:
+ '200':
+ description: Lista exitosa de mascotas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ example: # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ - name: Whiskers
+ animalType: Cat
+ - name: Daisy
+ animalType: Dog
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ name:
+ type: string
+ animalType:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR094/valid-example.json b/src/test/resources/checks/v31/examples/OAR094/valid-example.json
new file mode 100644
index 00000000..891f164d
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR094/valid-example.json
@@ -0,0 +1,62 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API con Examples",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Devuelve una lista de mascotas",
+ "responses": {
+ "200": {
+ "description": "Lista exitosa de mascotas",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ },
+ "examples": {
+ "catExample": {
+ "value": [
+ {
+ "name": "Whiskers",
+ "animalType": "Cat"
+ }
+ ]
+ },
+ "dogExample": {
+ "value": [
+ {
+ "name": "Daisy",
+ "animalType": "Dog"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "animalType": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/examples/OAR094/valid-example.yaml b/src/test/resources/checks/v31/examples/OAR094/valid-example.yaml
new file mode 100644
index 00000000..a7211027
--- /dev/null
+++ b/src/test/resources/checks/v31/examples/OAR094/valid-example.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ title: API con Examples
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Devuelve una lista de mascotas
+ responses:
+ '200':
+ description: Lista exitosa de mascotas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ examples:
+ catExample:
+ value:
+ - name: Whiskers
+ animalType: Cat
+ dogExample:
+ value:
+ - name: Daisy
+ animalType: Dog
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ name:
+ type: string
+ animalType:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR006/without-anything.json b/src/test/resources/checks/v31/format/OAR006/without-anything.json
new file mode 100644
index 00000000..c12e90bf
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR006/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": { # Noncompliant {{OAR006: Section requestBody is mandatory}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR006/without-anything.yaml b/src/test/resources/checks/v31/format/OAR006/without-anything.yaml
new file mode 100644
index 00000000..0d07eb68
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR006/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR006: Section requestBody is mandatory}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR007/without-anything.json b/src/test/resources/checks/v31/format/OAR007/without-anything.json
new file mode 100644
index 00000000..a7cccf09
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR007/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR007: Section content is mandatory}}
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR007/without-anything.yaml b/src/test/resources/checks/v31/format/OAR007/without-anything.yaml
new file mode 100644
index 00000000..2a4a9580
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR007/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200: # Noncompliant {{OAR007: Section content is mandatory}}
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.json b/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.json
new file mode 100644
index 00000000..cb1e7ca9
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": { # Noncompliant {{OAR009: requestBody not allowed with operation 'GET'}}
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.yaml b/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.yaml
new file mode 100644
index 00000000..88e6ab85
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/operation-not-allows-request-body.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get: # Noncompliant {{OAR009: requestBody not allowed with operation 'GET'}}
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.json b/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.json
new file mode 100644
index 00000000..6e1385c3
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.json
@@ -0,0 +1,43 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.yaml b/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.yaml
new file mode 100644
index 00000000..b914bb12
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-default-and-$ref.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json: {}
+ application/xml: {}
+paths:
+ /pets:
+ post:
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ description: Ok
+ put:
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.json b/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.json
new file mode 100644
index 00000000..fcbaa75d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/xml": {},
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.yaml b/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.yaml
new file mode 100644
index 00000000..2ff870ec
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-default-and-specific.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content:
+ application/xml: {}
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-specific.json b/src/test/resources/checks/v31/format/OAR009/with-specific.json
new file mode 100644
index 00000000..1321836e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-specific.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-specific.yaml b/src/test/resources/checks/v31/format/OAR009/with-specific.yaml
new file mode 100644
index 00000000..2732b297
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-specific.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.json b/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.json
new file mode 100644
index 00000000..f65659c0
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/text": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.yaml
new file mode 100644
index 00000000..f73d07ef
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-wrong-default-and-specific.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/text: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-wrong-default.json b/src/test/resources/checks/v31/format/OAR009/with-wrong-default.json
new file mode 100644
index 00000000..977475d4
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-wrong-default.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/text": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/with-wrong-default.yaml b/src/test/resources/checks/v31/format/OAR009/with-wrong-default.yaml
new file mode 100644
index 00000000..b42810a7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/with-wrong-default.yaml
@@ -0,0 +1,13 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/text: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/without-anything.json b/src/test/resources/checks/v31/format/OAR009/without-anything.json
new file mode 100644
index 00000000..b2618e4f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR009/without-anything.yaml b/src/test/resources/checks/v31/format/OAR009/without-anything.yaml
new file mode 100644
index 00000000..e0606d8c
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR009/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.json b/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.json
new file mode 100644
index 00000000..ebcb2191
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.json
@@ -0,0 +1,29 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.yaml b/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.yaml
new file mode 100644
index 00000000..2ad5d668
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-default-and-$ref.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json: {}
+ application/xml: {}
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/PetsResponse'
diff --git a/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.json b/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.json
new file mode 100644
index 00000000..265464aa
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.yaml b/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.yaml
new file mode 100644
index 00000000..bbcc31a4
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-default-and-specific.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
+ /owners:
+ get:
+ responses:
+ '200':
+ description: Ok
+ content:
+ application/json: {}
+ application/xml: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-specific.json b/src/test/resources/checks/v31/format/OAR010/with-specific.json
new file mode 100644
index 00000000..87e39490
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-specific.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-specific.yaml b/src/test/resources/checks/v31/format/OAR010/with-specific.yaml
new file mode 100644
index 00000000..ab6e19fa
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-specific.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json: {}
+ /owners:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.json b/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.json
new file mode 100644
index 00000000..968f61cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/text": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.yaml
new file mode 100644
index 00000000..f85a8b61
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-wrong-default-and-specific.yaml
@@ -0,0 +1,19 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ "/pets":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
+ "/owners":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/text: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-wrong-default.json b/src/test/resources/checks/v31/format/OAR010/with-wrong-default.json
new file mode 100644
index 00000000..77d537e7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-wrong-default.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/text": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/with-wrong-default.yaml b/src/test/resources/checks/v31/format/OAR010/with-wrong-default.yaml
new file mode 100644
index 00000000..45ccab83
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/with-wrong-default.yaml
@@ -0,0 +1,12 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ "/pets":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/text: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/without-anything.json b/src/test/resources/checks/v31/format/OAR010/without-anything.json
new file mode 100644
index 00000000..9d3c99ba
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR010/without-anything.yaml b/src/test/resources/checks/v31/format/OAR010/without-anything.yaml
new file mode 100644
index 00000000..d563f6d0
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR010/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/base-path-ok.json b/src/test/resources/checks/v31/format/OAR011/base-path-ok.json
new file mode 100644
index 00000000..a461588e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/base-path-ok.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "https://petstore.swagger.io/api-store/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/base-path-ok.yaml b/src/test/resources/checks/v31/format/OAR011/base-path-ok.yaml
new file mode 100644
index 00000000..e2a055bb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/base-path-ok.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-store/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/base-path-wrong.json b/src/test/resources/checks/v31/format/OAR011/base-path-wrong.json
new file mode 100644
index 00000000..afda8f94
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/base-path-wrong.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "https://petstore.swagger.io/APIStore/v1" # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/base-path-wrong.yaml b/src/test/resources/checks/v31/format/OAR011/base-path-wrong.yaml
new file mode 100644
index 00000000..353195af
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/base-path-wrong.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/APIStore/v1 # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/plain.json b/src/test/resources/checks/v31/format/OAR011/plain.json
new file mode 100644
index 00000000..6e4e6c27
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/plain.json
@@ -0,0 +1,90 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets/{id}": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS/{id}": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}/external-info": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets/{id}/EXternal_INFO": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS/{id}/externalInfo": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR011/plain.yaml b/src/test/resources/checks/v31/format/OAR011/plain.yaml
new file mode 100644
index 00000000..c9ff7eeb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR011/plain.yaml
@@ -0,0 +1,50 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets/{id}: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS/{id}: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{id}/external-info:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets/{id}/EXternal_INFO: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS/{id}/externalInfo: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/camel-case-plain.json b/src/test/resources/checks/v31/format/OAR012/camel-case-plain.json
new file mode 100644
index 00000000..68635bc7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/camel-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/camel-case-plain.yaml b/src/test/resources/checks/v31/format/OAR012/camel-case-plain.yaml
new file mode 100644
index 00000000..542366c3
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/camel-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: path
+ name: petId
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: path
+ name: petId
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.json b/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.json
new file mode 100644
index 00000000..67e45d45
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-Type", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ },
+ "petAge": {
+ "type": "number"
+ },
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.yaml b/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.yaml
new file mode 100644
index 00000000..61c03ec2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/camel-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.json b/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.json
new file mode 100644
index 00000000..47146bf9
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.yaml b/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.yaml
new file mode 100644
index 00000000..7c42ef9a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/kebab-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.json b/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.json
new file mode 100644
index 00000000..db8c3a1f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-type",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": {
+ "type": "string"
+ },
+ "petAge": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "number"
+ },
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.yaml b/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.yaml
new file mode 100644
index 00000000..1e62f853
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/kebab-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/snake-case-plain.json b/src/test/resources/checks/v31/format/OAR012/snake-case-plain.json
new file mode 100644
index 00000000..f3c64e30
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/snake-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/snake-case-plain.yaml b/src/test/resources/checks/v31/format/OAR012/snake-case-plain.yaml
new file mode 100644
index 00000000..e4b8a1f0
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/snake-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.json b/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.json
new file mode 100644
index 00000000..52846b38
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-Type", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ },
+ "petAge": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "number"
+ },
+ "pet_name": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.yaml b/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.yaml
new file mode 100644
index 00000000..ed7ae02e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR012/snake-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ pet_name:
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ petName: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR016/nested.json b/src/test/resources/checks/v31/format/OAR016/nested.json
new file mode 100644
index 00000000..10b592a8
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/nested.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR016/nested.yaml b/src/test/resources/checks/v31/format/OAR016/nested.yaml
new file mode 100644
index 00000000..471f8ebe
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/nested.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int64
+
diff --git a/src/test/resources/checks/v31/format/OAR016/plain.json b/src/test/resources/checks/v31/format/OAR016/plain.json
new file mode 100644
index 00000000..6191bf50
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "product_id": {
+ "type": "integer", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int32"
+ },
+ "price": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR016/plain.yaml b/src/test/resources/checks/v31/format/OAR016/plain.yaml
new file mode 100644
index 00000000..6a11aa64
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/plain.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ product_id:
+ type: integer # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int128
+ line:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int32
+ price:
+ type: number
+ format: double
+
diff --git a/src/test/resources/checks/v31/format/OAR016/with-$ref.json b/src/test/resources/checks/v31/format/OAR016/with-$ref.json
new file mode 100644
index 00000000..21b1d55f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR016/with-$ref.yaml b/src/test/resources/checks/v31/format/OAR016/with-$ref.yaml
new file mode 100644
index 00000000..fffed48c
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR016/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int64
diff --git a/src/test/resources/checks/v31/format/OAR037/complete.json b/src/test/resources/checks/v31/format/OAR037/complete.json
new file mode 100644
index 00000000..8c943299
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/complete.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "paramOne": {
+ "in": "header",
+ "name": "paramOne",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ },
+ "paramTwo": {
+ "in": "header",
+ "name": "paramTwo",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ },
+ "paths": {
+ "/invoices": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/paramTwo"
+ },
+ {
+ "in": "header",
+ "name": "paramThree",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/paramOne"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "without": {
+ "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ },
+ "date": {
+ "type": "string",
+ "format": "date"
+ },
+ "date-time": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ },
+ "byte": {
+ "type": "string",
+ "format": "byte"
+ },
+ "binary": {
+ "type": "string",
+ "format": "binary"
+ },
+ "email": {
+ "type": "string",
+ "format": "email"
+ },
+ "uuid": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "uri": {
+ "type": "string",
+ "format": "uri"
+ },
+ "hostname": {
+ "type": "string",
+ "format": "hostname"
+ },
+ "ipv4": {
+ "type": "string",
+ "format": "ipv4"
+ },
+ "ipv6": {
+ "type": "string",
+ "format": "ipv6"
+ },
+ "other": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR037/complete.yaml b/src/test/resources/checks/v31/format/OAR037/complete.yaml
new file mode 100644
index 00000000..769a4793
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/complete.yaml
@@ -0,0 +1,76 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ paramOne:
+ in: header
+ name: paramOne
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+ paramTwo:
+ in: header
+ name: paramTwo
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+paths:
+ /invoices:
+ parameters:
+ - $ref: '#/components/parameters/paramTwo'
+ - in: header
+ name: paramThree
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+ get:
+ parameters:
+ - $ref: '#/components/parameters/paramOne'
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ without:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ date:
+ type: string
+ format: date
+ date-time:
+ type: string
+ format: date-time
+ password:
+ type: string
+ format: password
+ byte:
+ type: string
+ format: byte
+ binary:
+ type: string
+ format: binary
+ email:
+ type: string
+ format: email
+ uuid:
+ type: string
+ format: uuid
+ uri:
+ type: string
+ format: uri
+ hostname:
+ type: string
+ format: hostname
+ ipv4:
+ type: string
+ format: ipv4
+ ipv6:
+ type: string
+ format: ipv6
+ other:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v31/format/OAR037/nested.json b/src/test/resources/checks/v31/format/OAR037/nested.json
new file mode 100644
index 00000000..7d632201
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/nested.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR037/nested.yaml b/src/test/resources/checks/v31/format/OAR037/nested.yaml
new file mode 100644
index 00000000..4a1accb7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/nested.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ nested:
+ type: object
+ properties:
+ value:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+
diff --git a/src/test/resources/checks/v31/format/OAR037/with-$ref.json b/src/test/resources/checks/v31/format/OAR037/with-$ref.json
new file mode 100644
index 00000000..d5ed29ea
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml
new file mode 100644
index 00000000..b6437060
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v31/format/OAR042/incorrect-version.json b/src/test/resources/checks/v31/format/OAR042/incorrect-version.json
new file mode 100644
index 00000000..f7a8fc9e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/incorrect-version.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1.0" # Noncompliant {{OAR042: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/incorrect-version.yaml b/src/test/resources/checks/v31/format/OAR042/incorrect-version.yaml
new file mode 100644
index 00000000..c998e93e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/incorrect-version.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1.0 # Noncompliant {{OAR042: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/too-long.json b/src/test/resources/checks/v31/format/OAR042/too-long.json
new file mode 100644
index 00000000..cf18102e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/too-long.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1/vida" # Noncompliant {{OAR042: Path has to many parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/too-long.yaml b/src/test/resources/checks/v31/format/OAR042/too-long.yaml
new file mode 100644
index 00000000..a2e8437b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/too-long.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1/vida # Noncompliant {{OAR042: Path has to many parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/too-short.json b/src/test/resources/checks/v31/format/OAR042/too-short.json
new file mode 100644
index 00000000..4850c130
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/too-short.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros" # Noncompliant {{OAR042: Path has to few parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/too-short.yaml b/src/test/resources/checks/v31/format/OAR042/too-short.yaml
new file mode 100644
index 00000000..16c63bf8
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/too-short.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros # Noncompliant {{OAR042: Path has to few parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/valid.json b/src/test/resources/checks/v31/format/OAR042/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/valid.yaml b/src/test/resources/checks/v31/format/OAR042/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/without-api-prefix.json b/src/test/resources/checks/v31/format/OAR042/without-api-prefix.json
new file mode 100644
index 00000000..0eaad7fa
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/without-api-prefix.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/seguros/v1" # Noncompliant {{OAR042: API name must start with prefix 'api-'}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR042/without-api-prefix.yaml b/src/test/resources/checks/v31/format/OAR042/without-api-prefix.yaml
new file mode 100644
index 00000000..84e5630f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR042/without-api-prefix.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/seguros/v1 # Noncompliant {{OAR042: API name must start with prefix 'api-'}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR044/media-type.json b/src/test/resources/checks/v31/format/OAR044/media-type.json
new file mode 100644
index 00000000..86ec986a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR044/media-type.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "some operation",
+ "content" : {
+ "application" : { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ }
+ }
+ },
+ "parameters" : [ {
+ "name" : "someParam",
+ "in" : "query",
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ "text/plain" : { }
+ }
+ },
+ {
+ "name" : "otherParam",
+ "in" : "path"
+ } ]
+ },
+ "post" : {
+ "requestBody" : {
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ "text/*" : { }
+ }
+ },
+ "responses" : {
+ "200" : {
+ "description" : "some operation"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR044/media-type.yaml b/src/test/resources/checks/v31/format/OAR044/media-type.yaml
new file mode 100644
index 00000000..60015c9b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR044/media-type.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: some operation
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ parameters:
+ - name: someParam
+ in: query
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ 'text/plain': {} # invalid (only 1 content allowed by spec), but should not be caught by this rule
+ - name: otherParam
+ in: path
+ post:
+ requestBody:
+ content:
+ 'application': { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ 'text/*': { }
+ responses:
+ '200':
+ description: some operation
diff --git a/src/test/resources/checks/v31/format/OAR050/provide-summary.json b/src/test/resources/checks/v31/format/OAR050/provide-summary.json
new file mode 100644
index 00000000..8d2ea1b5
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR050/provide-summary.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : { # Noncompliant {{OAR050: Provide a summary for each operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR050/provide-summary.yaml b/src/test/resources/checks/v31/format/OAR050/provide-summary.yaml
new file mode 100644
index 00000000..b523fda2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR050/provide-summary.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR050: Provide a summary for each operation}}
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR051/different-description.json b/src/test/resources/checks/v31/format/OAR051/different-description.json
new file mode 100644
index 00000000..e86c1152
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR051/different-description.json
@@ -0,0 +1,31 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "summary" : "create a pet",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "Create a pet",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "List all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR051/different-description.yaml b/src/test/resources/checks/v31/format/OAR051/different-description.yaml
new file mode 100644
index 00000000..ab7d7f43
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR051/different-description.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ summary: create a pet
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: Create a pet
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: List all pets
+# ^^^^^^^^^^^
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR052/nested.json b/src/test/resources/checks/v31/format/OAR052/nested.json
new file mode 100644
index 00000000..c4657e7a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/nested.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR052/nested.yaml b/src/test/resources/checks/v31/format/OAR052/nested.yaml
new file mode 100644
index 00000000..5d6710d3
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/nested.yaml
@@ -0,0 +1,24 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
+
diff --git a/src/test/resources/checks/v31/format/OAR052/plain.json b/src/test/resources/checks/v31/format/OAR052/plain.json
new file mode 100644
index 00000000..e2e764fc
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/plain.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "product_id": {
+ "type": "integer" # Noncompliant {{OAR052: Numeric types requires a format}}
+ },
+ "line": {
+ "type": "integer" # Noncompliant {{OAR052: Numeric types requires a format}}
+ },
+ "price": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR052/plain.yaml b/src/test/resources/checks/v31/format/OAR052/plain.yaml
new file mode 100644
index 00000000..5acaf918
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/plain.yaml
@@ -0,0 +1,24 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int32
+ product_id:
+ type: integer # Noncompliant {{OAR052: Numeric types requires a format}}
+ line:
+ type: integer # Noncompliant {{OAR052: Numeric types requires a format}}
+ price:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
diff --git a/src/test/resources/checks/v31/format/OAR052/with-$ref.json b/src/test/resources/checks/v31/format/OAR052/with-$ref.json
new file mode 100644
index 00000000..d4bc6a7d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/with-$ref.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR052/with-$ref.yaml b/src/test/resources/checks/v31/format/OAR052/with-$ref.yaml
new file mode 100644
index 00000000..2cf00322
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR052/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
diff --git a/src/test/resources/checks/v31/format/OAR066/snake-case-error.json b/src/test/resources/checks/v31/format/OAR066/snake-case-error.json
new file mode 100644
index 00000000..6e141341
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR066/snake-case-error.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "firstName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "last_name": {
+ "type": "object",
+ "properties": {
+ "streetName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "street_name": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "userID": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "user_name": {
+ "type": "object",
+ "properties": {
+ "userId": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "user_id": { "type": "integer" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR066/snake-case-error.yaml b/src/test/resources/checks/v31/format/OAR066/snake-case-error.yaml
new file mode 100644
index 00000000..6abbf89b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR066/snake-case-error.yaml
@@ -0,0 +1,39 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ firstName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ last_name:
+ type: object
+ properties:
+ streetName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ street_name:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ userID: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_name:
+ type: object
+ properties:
+ userId: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_id:
+ type: integer
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR066/valid.json b/src/test/resources/checks/v31/format/OAR066/valid.json
new file mode 100644
index 00000000..2684353a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR066/valid.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "last_name": { "type": "string" },
+ "_links": { "type": "object" },
+ "_embedded": { "type": "object" },
+ "@context": { "type": "string" },
+ "@type": { "type": "string" },
+ "@id": { "type": "string" },
+ "x-internal": { "type": "boolean" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_name": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR066/valid.yaml b/src/test/resources/checks/v31/format/OAR066/valid.yaml
new file mode 100644
index 00000000..6edab18e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR066/valid.yaml
@@ -0,0 +1,37 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ last_name:
+ type: string
+ _links:
+ type: object
+ _embedded:
+ type: object
+ "@context":
+ type: string
+ "@type":
+ type: string
+ "@id":
+ type: string
+ x-internal:
+ type: boolean
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR067/camel-case-error.json b/src/test/resources/checks/v31/format/OAR067/camel-case-error.json
new file mode 100644
index 00000000..1fa9d435
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR067/camel-case-error.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "first_name": { "type": "string" }, # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ "lastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_id": { "type": "integer" }, # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ "userName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR067/camel-case-error.yaml b/src/test/resources/checks/v31/format/OAR067/camel-case-error.yaml
new file mode 100644
index 00000000..05c51345
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR067/camel-case-error.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ first_name: # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ type: string
+ lastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_id: # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ type: integer
+ userName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR067/valid.json b/src/test/resources/checks/v31/format/OAR067/valid.json
new file mode 100644
index 00000000..8e10ee7b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR067/valid.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "lastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "userName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR067/valid.yaml b/src/test/resources/checks/v31/format/OAR067/valid.yaml
new file mode 100644
index 00000000..8c0124b7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR067/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ lastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ userName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR068/externalref.yaml b/src/test/resources/checks/v31/format/OAR068/externalref.yaml
new file mode 100644
index 00000000..bf976457
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR068/externalref.yaml
@@ -0,0 +1,62 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ $ref: >-
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR068.yaml#/components/schemas/datosUsuario
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ $ref: >-
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/ErrorMessage
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR068/pascal-case-error.json b/src/test/resources/checks/v31/format/OAR068/pascal-case-error.json
new file mode 100644
index 00000000..c9e0898c
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR068/pascal-case-error.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "first_name": { "type": "string" }, # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_id": { "type": "integer" }, # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ "UserName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR068/pascal-case-error.yaml b/src/test/resources/checks/v31/format/OAR068/pascal-case-error.yaml
new file mode 100644
index 00000000..6261794d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR068/pascal-case-error.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ first_name: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ type: string
+ LastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_Id: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ type: integer
+ UserName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR068/valid.json b/src/test/resources/checks/v31/format/OAR068/valid.json
new file mode 100644
index 00000000..8a6b1e3f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR068/valid.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "LastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "UserName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR068/valid.yaml b/src/test/resources/checks/v31/format/OAR068/valid.yaml
new file mode 100644
index 00000000..1bef4d8e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR068/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ LastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ UserName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.json b/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.json
new file mode 100644
index 00000000..e24c26d4
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "API que cumple"
+ },
+ "paths": {
+ "/usuarios": {
+ "get": {
+ "parameters": [
+ {
+ "name": "username",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "userFirstName", # Noncompliant {{OAR077: All parameters in query must be snake_case}}
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.yaml b/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.yaml
new file mode 100644
index 00000000..92c3971c
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR077/not-valid-in-query.yaml
@@ -0,0 +1,19 @@
+ openapi: "3.1.0"
+ info:
+ version: "1.0.0"
+ title: "API que cumple"
+ paths:
+ /usuarios:
+ get:
+ parameters:
+ - name: username
+ in: query
+ schema:
+ type: string
+ - name: userFirstName # Noncompliant {{OAR077: All parameters in query must be snake_case}}
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR077/valid-in-query.json b/src/test/resources/checks/v31/format/OAR077/valid-in-query.json
new file mode 100644
index 00000000..911d9e83
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR077/valid-in-query.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "API que cumple"
+ },
+ "paths": {
+ "/usuarios": {
+ "get": {
+ "parameters": [
+ {
+ "name": "username",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "user_first_name",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR077/valid-in-query.yaml b/src/test/resources/checks/v31/format/OAR077/valid-in-query.yaml
new file mode 100644
index 00000000..fbfe9032
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR077/valid-in-query.yaml
@@ -0,0 +1,19 @@
+ openapi: "3.1.0"
+ info:
+ version: "1.0.0"
+ title: "API que cumple"
+ paths:
+ /usuarios:
+ get:
+ parameters:
+ - name: username
+ in: query
+ schema:
+ type: string
+ - name: hola_hola
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR086/external-refexample.yaml b/src/test/resources/checks/v31/format/OAR086/external-refexample.yaml
new file mode 100644
index 00000000..da58e493
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/external-refexample.yaml
@@ -0,0 +1,62 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/datosUsuario
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/ErrorMessage
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR086/internal-refexample.yaml b/src/test/resources/checks/v31/format/OAR086/internal-refexample.yaml
new file mode 100644
index 00000000..41131129
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/internal-refexample.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios.
+ description: Método que permite obtener un listado con datos básicos de un usuario.
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: Listado de suberrores usado para dar información más detallada,
+ como en el caso de errores de validación.
diff --git a/src/test/resources/checks/v31/format/OAR086/invalid-example.json b/src/test/resources/checks/v31/format/OAR086/invalid-example.json
new file mode 100644
index 00000000..6c8b1e3b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/invalid-example.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "esta es la descripción de la API." # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "lista de mascotas.",
+ "description": "", # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ "parameters": [
+ {
+ "name": "desde",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "describe init time" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ },
+ {
+ "name": "hasta",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "descibe parameter" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "una lista de mascotas." # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR086/invalid-example.yaml b/src/test/resources/checks/v31/format/OAR086/invalid-example.yaml
new file mode 100644
index 00000000..70567c6e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/invalid-example.yaml
@@ -0,0 +1,41 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+
+paths:
+ /pets:
+ get:
+ summary: lista de mascotas.
+ description: esta ruta devuelve una lista de mascotas # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: describe init time # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: descibe parameter # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ responses:
+ '200':
+ description: Una lista de mascotas # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR086/valid-example.json b/src/test/resources/checks/v31/format/OAR086/valid-example.json
new file mode 100644
index 00000000..d5ab5527
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/valid-example.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API."
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas.",
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "parameters": [
+ {
+ "name": "desde",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "Especifica el parámetro."
+ },
+ {
+ "name": "hasta",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "Especifica el parámetro."
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota."
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR086/valid-example.yaml b/src/test/resources/checks/v31/format/OAR086/valid-example.yaml
new file mode 100644
index 00000000..80f3e098
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR086/valid-example.yaml
@@ -0,0 +1,69 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ description: API de ejemplo para pruebas.
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios.
+ description: Método que permite obtener un listado con datos básicos de un usuario.
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: Especifica el parámetro.
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: Especifica el parámetro.
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción.
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: Listado de suberrores usado para dar información más detallada,
+ como en el caso de errores de validación.
diff --git a/src/test/resources/checks/v31/format/OAR087/invalid-example.json b/src/test/resources/checks/v31/format/OAR087/invalid-example.json
new file mode 100644
index 00000000..889a27d5
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR087/invalid-example.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API.",
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas", # Noncompliant {{OAR087: Summaries must begin with a capital letter, end with a period and not be empty}}
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas retornada con éxito."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota.",
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR087/invalid-example.yaml b/src/test/resources/checks/v31/format/OAR087/invalid-example.yaml
new file mode 100644
index 00000000..75505d39
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR087/invalid-example.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API.
+
+paths:
+ /pets:
+ get:
+ summary: lista de mascotas. # Noncompliant {{OAR087: Summaries must begin with a capital letter, end with a period and not be empty}}
+ description: Esta ruta devuelve una lista de mascotas.
+ responses:
+ '200':
+ description: Una lista de mascotas retornada con éxito.
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota.
diff --git a/src/test/resources/checks/v31/format/OAR087/valid-example.json b/src/test/resources/checks/v31/format/OAR087/valid-example.json
new file mode 100644
index 00000000..8cd05ea7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR087/valid-example.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API.",
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas.",
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas retornada con éxito."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota.",
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR087/valid-example.yaml b/src/test/resources/checks/v31/format/OAR087/valid-example.yaml
new file mode 100644
index 00000000..b34f0e82
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR087/valid-example.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API.
+
+paths:
+ /pets:
+ get:
+ summary: Lista de mascotas.
+ description: Esta ruta devuelve una lista de mascotas.
+ responses:
+ '200':
+ description: Una lista de mascotas retornada con éxito.
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota.
diff --git a/src/test/resources/checks/v31/format/OAR088/invalid-ref.json b/src/test/resources/checks/v31/format/OAR088/invalid-ref.json
new file mode 100644
index 00000000..ced98ae3
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR088/invalid-ref.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0"
+ },
+ "paths": {
+ "/mascotas": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/idMascotaRef" # Noncompliant {{OAR088: The $ref of a parameter must end with the suffix Param}}
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Lista de mascotas"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "idMascotaRef": {
+ "name": "idMascota",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR088/invalid-ref.yaml b/src/test/resources/checks/v31/format/OAR088/invalid-ref.yaml
new file mode 100644
index 00000000..1abb7819
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR088/invalid-ref.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ title: API de ejemplo
+ version: "1.0"
+paths:
+ /mascotas:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/idMascotaRef' # Noncompliant {{OAR088: The $ref of a parameter must end with the suffix Param}}
+ responses:
+ '200':
+ description: Lista de mascotas
+components:
+ parameters:
+ idMascotaRef:
+ name: idMascota
+ in: query
+ required: true
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR088/valid-ref.json b/src/test/resources/checks/v31/format/OAR088/valid-ref.json
new file mode 100644
index 00000000..c361f98d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR088/valid-ref.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0"
+ },
+ "paths": {
+ "/mascotas": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/idMascotaParam"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Lista de mascotas"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "idMascotaParam": {
+ "name": "idMascota",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR088/valid-ref.yaml b/src/test/resources/checks/v31/format/OAR088/valid-ref.yaml
new file mode 100644
index 00000000..ef683a20
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR088/valid-ref.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ title: API de ejemplo
+ version: "1.0"
+paths:
+ /mascotas:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/idMascotaParam'
+ responses:
+ '200':
+ description: Lista de mascotas
+components:
+ parameters:
+ idMascotaParam:
+ name: idMascota
+ in: query
+ required: true
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR089/invalid-ref.json b/src/test/resources/checks/v31/format/OAR089/invalid-ref.json
new file mode 100644
index 00000000..8cc79655
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR089/invalid-ref.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API Sample",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "name": "petId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ },
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetDetailsIncorrect" # Noncompliant {{OAR089: The $ref of a request body must end with the suffix Body}}
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "PetDetailsIncorrect": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR089/invalid-ref.yaml b/src/test/resources/checks/v31/format/OAR089/invalid-ref.yaml
new file mode 100644
index 00000000..49be8527
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR089/invalid-ref.yaml
@@ -0,0 +1,28 @@
+openapi: '3.1.0'
+info:
+ title: API Sample
+ version: '1.0.0'
+paths:
+ /pets:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Successful response
+ requestBody:
+ $ref: '#/components/requestBodies/PetDetailsIncorrect' # Noncompliant {{OAR089: The $ref of a request body must end with the suffix Body}}
+components:
+ requestBodies:
+ PetDetailsIncorrect:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR089/valid-ref.json b/src/test/resources/checks/v31/format/OAR089/valid-ref.json
new file mode 100644
index 00000000..55fb2ff7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR089/valid-ref.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API Sample",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "name": "petId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ },
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetDetailsBody"
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "PetDetailsBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR089/valid-ref.yaml b/src/test/resources/checks/v31/format/OAR089/valid-ref.yaml
new file mode 100644
index 00000000..0c67ffbb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR089/valid-ref.yaml
@@ -0,0 +1,28 @@
+openapi: '3.1.0'
+info:
+ title: API Sample
+ version: '1.0.0'
+paths:
+ /pets:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Successful response
+ requestBody:
+ $ref: '#/components/requestBodies/PetDetailsBody'
+components:
+ requestBodies:
+ PetDetailsBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR090/invalid-ref.json b/src/test/resources/checks/v31/format/OAR090/invalid-ref.json
new file mode 100644
index 00000000..b92997a8
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR090/invalid-ref.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/InvalidRef" # Noncompliant {{OAR090: The $ref of a response must end with the suffix Response}}
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "InvalidRef": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR090/invalid-ref.yaml b/src/test/resources/checks/v31/format/OAR090/invalid-ref.yaml
new file mode 100644
index 00000000..2d69ecf6
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR090/invalid-ref.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/InvalidRef' # Noncompliant {{OAR090: The $ref of a response must end with the suffix Response}}
+components:
+ responses:
+ InvalidRef:
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR090/valid-ref.json b/src/test/resources/checks/v31/format/OAR090/valid-ref.json
new file mode 100644
index 00000000..22faee1d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR090/valid-ref.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/SuccessResponse"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "SuccessResponse": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR090/valid-ref.yaml b/src/test/resources/checks/v31/format/OAR090/valid-ref.yaml
new file mode 100644
index 00000000..7996672c
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR090/valid-ref.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/SuccessResponse'
+components:
+ responses:
+ SuccessResponse:
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR097/too-short.json b/src/test/resources/checks/v31/format/OAR097/too-short.json
new file mode 100644
index 00000000..9a614754
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR097/too-short.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros" # Noncompliant {{OAR097: Path has to few parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR097/too-short.yaml b/src/test/resources/checks/v31/format/OAR097/too-short.yaml
new file mode 100644
index 00000000..3b60c330
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR097/too-short.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros # Noncompliant {{OAR097: Path has to few parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR097/valid.json b/src/test/resources/checks/v31/format/OAR097/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR097/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR097/valid.yaml b/src/test/resources/checks/v31/format/OAR097/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR097/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR098/too-long.json b/src/test/resources/checks/v31/format/OAR098/too-long.json
new file mode 100644
index 00000000..b77b2423
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR098/too-long.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1/vida" # Noncompliant {{OAR098: Path has to many parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR098/too-long.yaml b/src/test/resources/checks/v31/format/OAR098/too-long.yaml
new file mode 100644
index 00000000..d396d837
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR098/too-long.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1/vida # Noncompliant {{OAR098: Path has to many parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR098/valid.json b/src/test/resources/checks/v31/format/OAR098/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR098/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR098/valid.yaml b/src/test/resources/checks/v31/format/OAR098/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR098/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR099/valid.json b/src/test/resources/checks/v31/format/OAR099/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR099/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR099/valid.yaml b/src/test/resources/checks/v31/format/OAR099/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR099/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR099/without-api-prefix.json b/src/test/resources/checks/v31/format/OAR099/without-api-prefix.json
new file mode 100644
index 00000000..3004908b
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR099/without-api-prefix.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/seguros/v1" # Noncompliant {{OAR099: API name must start with prefix 'api-'}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR099/without-api-prefix.yaml b/src/test/resources/checks/v31/format/OAR099/without-api-prefix.yaml
new file mode 100644
index 00000000..52d0ce55
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR099/without-api-prefix.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/seguros/v1 # Noncompliant {{OAR099: API name must start with prefix 'api-'}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR100/incorrect-version.json b/src/test/resources/checks/v31/format/OAR100/incorrect-version.json
new file mode 100644
index 00000000..2e24e8e4
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR100/incorrect-version.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1.0" # Noncompliant {{OAR100: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR100/incorrect-version.yaml b/src/test/resources/checks/v31/format/OAR100/incorrect-version.yaml
new file mode 100644
index 00000000..a6aeb985
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR100/incorrect-version.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1.0 # Noncompliant {{OAR100: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR100/valid.json b/src/test/resources/checks/v31/format/OAR100/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR100/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR100/valid.yaml b/src/test/resources/checks/v31/format/OAR100/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR100/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/empty-path.json b/src/test/resources/checks/v31/format/OAR101/empty-path.json
new file mode 100644
index 00000000..e207fd95
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/empty-path.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/empty-path.yaml b/src/test/resources/checks/v31/format/OAR101/empty-path.yaml
new file mode 100644
index 00000000..1af86644
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/empty-path.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/invalid.json b/src/test/resources/checks/v31/format/OAR101/invalid.json
new file mode 100644
index 00000000..6c4219c6
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/invalid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/wrong/v1" # Noncompliant {{OAR101: The first part of the path is not allowed. Allowed values are: wrong}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/invalid.yaml b/src/test/resources/checks/v31/format/OAR101/invalid.yaml
new file mode 100644
index 00000000..7cf78e4d
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/wrong/v1 # Noncompliant {{OAR101: The first part of the path is not allowed. Allowed values are: wrong}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/valid-with-values.json b/src/test/resources/checks/v31/format/OAR101/valid-with-values.json
new file mode 100644
index 00000000..646c5820
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/valid-with-values.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/valid-with-values.yaml b/src/test/resources/checks/v31/format/OAR101/valid-with-values.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/valid-with-values.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/valid.json b/src/test/resources/checks/v31/format/OAR101/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR101/valid.yaml b/src/test/resources/checks/v31/format/OAR101/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR101/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/invalid.json b/src/test/resources/checks/v31/format/OAR102/invalid.json
new file mode 100644
index 00000000..6a65ea93
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/invalid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/wrong" # Noncompliant {{OAR102: The second part of the path is not allowed. Allowed values are: wrong}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/invalid.yaml b/src/test/resources/checks/v31/format/OAR102/invalid.yaml
new file mode 100644
index 00000000..213b4cf7
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/wrong # Noncompliant {{OAR102: The second part of the path is not allowed. Allowed values are: wrong}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/one-part-path.json b/src/test/resources/checks/v31/format/OAR102/one-part-path.json
new file mode 100644
index 00000000..a0c31961
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/one-part-path.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/one-part-path.yaml b/src/test/resources/checks/v31/format/OAR102/one-part-path.yaml
new file mode 100644
index 00000000..68b06983
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/one-part-path.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/valid-with-values.json b/src/test/resources/checks/v31/format/OAR102/valid-with-values.json
new file mode 100644
index 00000000..646c5820
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/valid-with-values.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/valid-with-values.yaml b/src/test/resources/checks/v31/format/OAR102/valid-with-values.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/valid-with-values.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/valid.json b/src/test/resources/checks/v31/format/OAR102/valid.json
new file mode 100644
index 00000000..f42208e2
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR102/valid.yaml b/src/test/resources/checks/v31/format/OAR102/valid.yaml
new file mode 100644
index 00000000..d57d39cb
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR102/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR110/valid.json b/src/test/resources/checks/v31/format/OAR110/valid.json
new file mode 100644
index 00000000..8ccf378f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR110/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de Ejemplo",
+ "version": "1.0.0",
+ "description": "Esta es una API de ejemplo.",
+ "termsOfService": "http://ejemplo.com/terminos/",
+ "contact": {
+ "name": "Soporte de API",
+ "url": "http://ejemplo.com/contacto",
+ "email": "contacto@ejemplo.com"
+ },
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR110/valid.yaml b/src/test/resources/checks/v31/format/OAR110/valid.yaml
new file mode 100644
index 00000000..b044e7c9
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR110/valid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ title: API de Ejemplo
+ version: 1.0.0
+ description: Esta es una API de ejemplo.
+ termsOfService: http://ejemplo.com/terminos/
+ contact:
+ name: Soporte de API
+ url: http://ejemplo.com/contacto
+ email: contacto@ejemplo.com
+ license:
+ name: aaa
+ url: awss
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR111/valid.json b/src/test/resources/checks/v31/format/OAR111/valid.json
new file mode 100644
index 00000000..8ccf378f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR111/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de Ejemplo",
+ "version": "1.0.0",
+ "description": "Esta es una API de ejemplo.",
+ "termsOfService": "http://ejemplo.com/terminos/",
+ "contact": {
+ "name": "Soporte de API",
+ "url": "http://ejemplo.com/contacto",
+ "email": "contacto@ejemplo.com"
+ },
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR111/valid.yaml b/src/test/resources/checks/v31/format/OAR111/valid.yaml
new file mode 100644
index 00000000..625fb374
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR111/valid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ title: API de Ejemplo
+ version: 1.0.0
+ description: Esta es una API de ejemplo.
+ termsOfService: http://ejemplo.com/terminos/
+ contact:
+ name: Soporte de API
+ url: http://ejemplo.com/contacto
+ email: contacto@ejemplo.com
+ license:
+ name: Apache 2.0
+ url: https://www.apache.org/licenses/LICENSE-2.0.html
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/format/OAR113/invalid.json b/src/test/resources/checks/v31/format/OAR113/invalid.json
new file mode 100644
index 00000000..2cf39330
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR113/invalid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/example": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "get": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "description": "Get example",
+ "responses": {
+ "200": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "description": "Successful response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExampleObject"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR113/invalid.yaml b/src/test/resources/checks/v31/format/OAR113/invalid.yaml
new file mode 100644
index 00000000..194ad4a4
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR113/invalid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: "1.0.0"
+ title: "Sample API"
+paths:
+ /example: # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ get: # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ description: "Get example"
+ responses:
+ "200": # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ description: "Successful response"
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ExampleObject"
+
diff --git a/src/test/resources/checks/v31/format/OAR113/valid.json b/src/test/resources/checks/v31/format/OAR113/valid.json
new file mode 100644
index 00000000..88a6b00a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR113/valid.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API",
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "x-custom-example": "example value",
+ "description": "Get example",
+ "responses": {
+ "200": {
+ "x-custom-example": "example value",
+ "description": "Successful response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExampleObject"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-custom-example": "example value"
+ }
+ },
+ "components": {
+ "schemas": {
+ "ExampleObject": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR113/valid.yaml b/src/test/resources/checks/v31/format/OAR113/valid.yaml
new file mode 100644
index 00000000..da6fd6ce
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR113/valid.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: "1.0.0"
+ title: "Sample API"
+paths:
+ /example:
+ get:
+ x-custom-example: "example"
+ description: "Get example"
+ responses:
+ "200":
+ x-custom-example: "example"
+ description: "Successful response"
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ExampleObject"
+ x-custom-example: "example"
+components:
+ schemas:
+ ExampleObject:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v31/format/OAR115/invalid.json b/src/test/resources/checks/v31/format/OAR115/invalid.json
new file mode 100644
index 00000000..7147848f
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR115/invalid.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Obtener lista de usuarios",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "400": {
+ "description": "Error de validación",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "code": { "type": "integer" },
+ "message": { "type": "string" }
+ },
+ "required":[
+ "code",
+ "message",
+ "otherfield" # Noncompliant {{OAR115: This value does not exist, it must be defined in the schema properties}}
+ ]
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR115/invalid.yaml b/src/test/resources/checks/v31/format/OAR115/invalid.yaml
new file mode 100644
index 00000000..29ea6f8e
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR115/invalid.yaml
@@ -0,0 +1,30 @@
+openapi: "3.1.0"
+info:
+ title: API de ejemplo
+ version: "1.0.0"
+paths:
+ /users:
+ get:
+ summary: Obtener lista de usuarios
+ responses:
+ '200':
+ description: OK
+ '400':
+ description: Error de validación
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ErrorResponse"
+components:
+ schemas:
+ ErrorResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ required:
+ - code
+ - message
+ - otherfield # Noncompliant {{OAR115: This value does not exist, it must be defined in the schema properties}}
diff --git a/src/test/resources/checks/v31/format/OAR115/valid.json b/src/test/resources/checks/v31/format/OAR115/valid.json
new file mode 100644
index 00000000..1bc0ee2a
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR115/valid.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Obtener lista de usuarios",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "400": {
+ "description": "Error de validación",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "code": { "type": "integer" },
+ "message": { "type": "string" }
+ },
+ "required":[
+ "code",
+ "message"
+ ]
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/format/OAR115/valid.yaml b/src/test/resources/checks/v31/format/OAR115/valid.yaml
new file mode 100644
index 00000000..16c59909
--- /dev/null
+++ b/src/test/resources/checks/v31/format/OAR115/valid.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ title: API de ejemplo
+ version: "1.0.0"
+paths:
+ /users:
+ get:
+ summary: Obtener lista de usuarios
+ responses:
+ '200':
+ description: OK
+ '400':
+ description: Error de validación
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ErrorResponse"
+components:
+ schemas:
+ ErrorResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ required:
+ - code
+ - message
diff --git a/src/test/resources/checks/v31/operations/OAR008/plain.json b/src/test/resources/checks/v31/operations/OAR008/plain.json
new file mode 100644
index 00000000..ab584727
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR008/plain.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "patch" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "put" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "delete" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "head" : { # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "options" : { # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR008/plain.yaml b/src/test/resources/checks/v31/operations/OAR008/plain.yaml
new file mode 100644
index 00000000..7465d2ea
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR008/plain.yaml
@@ -0,0 +1,34 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ patch:
+ responses:
+ 200:
+ description: Ok
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+ head: # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+ options: # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/operations/OAR013/plain.json b/src/test/resources/checks/v31/operations/OAR013/plain.json
new file mode 100644
index 00000000..f490b2bb
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR013/plain.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : { # Noncompliant {{OAR013: Default response is required}}
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "default" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR013/plain.yaml b/src/test/resources/checks/v31/operations/OAR013/plain.yaml
new file mode 100644
index 00000000..4b796abc
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR013/plain.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR013: Default response is required}}
+ 200:
+ description: Ok
+ post:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR014/plain.json b/src/test/resources/checks/v31/operations/OAR014/plain.json
new file mode 100644
index 00000000..ae30763d
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR014/plain.json
@@ -0,0 +1,54 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR014/plain.yaml b/src/test/resources/checks/v31/operations/OAR014/plain.yaml
new file mode 100644
index 00000000..0e563616
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR014/plain.yaml
@@ -0,0 +1,30 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR015/plain.json b/src/test/resources/checks/v31/operations/OAR015/plain.json
new file mode 100644
index 00000000..cbdd1838
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR015/plain.json
@@ -0,0 +1,72 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six/seven": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR015/plain.yaml b/src/test/resources/checks/v31/operations/OAR015/plain.yaml
new file mode 100644
index 00000000..e298945b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR015/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six/seven: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR017/plain.json b/src/test/resources/checks/v31/operations/OAR017/plain.json
new file mode 100644
index 00000000..40b9de7a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR017/plain.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/{one}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/two" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/me" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/me/three" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}/three" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}/{three}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/me/items/{id}" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR017/plain.yaml b/src/test/resources/checks/v31/operations/OAR017/plain.yaml
new file mode 100644
index 00000000..72bb577e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR017/plain.yaml
@@ -0,0 +1,45 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/me/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/operations/OAR018/plain.json b/src/test/resources/checks/v31/operations/OAR018/plain.json
new file mode 100644
index 00000000..81702ff0
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR018/plain.json
@@ -0,0 +1,194 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR018/plain.yaml b/src/test/resources/checks/v31/operations/OAR018/plain.yaml
new file mode 100644
index 00000000..7dda8975
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR018/plain.yaml
@@ -0,0 +1,114 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /resources:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}}}
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ patch:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+
+ /resources/get:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/delete:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}/other:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/no-post.json b/src/test/resources/checks/v31/operations/OAR027/no-post.json
new file mode 100644
index 00000000..eead3f51
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/no-post.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "201" : {
+ "description" : "Found"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/no-post.yaml b/src/test/resources/checks/v31/operations/OAR027/no-post.yaml
new file mode 100644
index 00000000..63054920
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/no-post.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 201:
+ description: Found
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.json b/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.json
new file mode 100644
index 00000000..d1359d6e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : {
+ "Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.yaml b/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.yaml
new file mode 100644
index 00000000..e772b5ce
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-with-location.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers:
+ Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.json b/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.json
new file mode 100644
index 00000000..e62d413a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "X-Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.yaml b/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.yaml
new file mode 100644
index 00000000..8e8b26a3
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-with-other-headers.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ X-Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.json b/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.json
new file mode 100644
index 00000000..efd4f635
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "description" : "Created"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.yaml b/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.yaml
new file mode 100644
index 00000000..33660a6a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-201-without-location.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ description: Created
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-no-201.json b/src/test/resources/checks/v31/operations/OAR027/post-no-201.json
new file mode 100644
index 00000000..361a35ce
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-no-201.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR027/post-no-201.yaml b/src/test/resources/checks/v31/operations/OAR027/post-no-201.yaml
new file mode 100644
index 00000000..efa20b71
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR027/post-no-201.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 200:
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/valid.json b/src/test/resources/checks/v31/operations/OAR030/valid.json
new file mode 100644
index 00000000..af20c983
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/valid.yaml b/src/test/resources/checks/v31/operations/OAR030/valid.yaml
new file mode 100644
index 00000000..08dbbc2b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.json b/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.json
new file mode 100644
index 00000000..d5a75192
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : { # Noncompliant {{OAR030: Method get must be declared}}
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.yaml b/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.yaml
new file mode 100644
index 00000000..343b365c
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/with-status-without-get.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status: # Noncompliant {{OAR030: Method get must be declared}}
+ post:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/without-status.json b/src/test/resources/checks/v31/operations/OAR030/without-status.json
new file mode 100644
index 00000000..840b42bb
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/without-status.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : { # Noncompliant {{OAR030: The path '/status' must be declared}}
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR030/without-status.yaml b/src/test/resources/checks/v31/operations/OAR030/without-status.yaml
new file mode 100644
index 00000000..b59b6167
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR030/without-status.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths: # Noncompliant {{OAR030: The path '/status' must be declared}}
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR032/forbidden-names.json b/src/test/resources/checks/v31/operations/OAR032/forbidden-names.json
new file mode 100644
index 00000000..401f94be
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR032/forbidden-names.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/elements" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/a/nested/items" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/another/{param}/with/valores" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR032/forbidden-names.yaml b/src/test/resources/checks/v31/operations/OAR032/forbidden-names.yaml
new file mode 100644
index 00000000..7810e795
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR032/forbidden-names.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /elements: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /a/nested/items: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /another/{param}/with/valores: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR032/valid.json b/src/test/resources/checks/v31/operations/OAR032/valid.json
new file mode 100644
index 00000000..9cfe7d75
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR032/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{elements}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR032/valid.yaml b/src/test/resources/checks/v31/operations/OAR032/valid.yaml
new file mode 100644
index 00000000..eae1ceba
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR032/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{elements}:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.json b/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.json
new file mode 100644
index 00000000..67723422
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.json
@@ -0,0 +1,48 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ },
+ "name" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.yaml b/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.yaml
new file mode 100644
index 00000000..fb5498dd
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-multiple-properties.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-one-property.json b/src/test/resources/checks/v31/operations/OAR038/valid-one-property.json
new file mode 100644
index 00000000..c4ded0b4
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-one-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-one-property.yaml b/src/test/resources/checks/v31/operations/OAR038/valid-one-property.yaml
new file mode 100644
index 00000000..50656cb5
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-one-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-with-error.json b/src/test/resources/checks/v31/operations/OAR038/valid-with-error.json
new file mode 100644
index 00000000..997c05d9
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-with-error.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "error" : {
+ "type" : "object",
+ "properties" : {
+ "message" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR038/valid-with-error.yaml b/src/test/resources/checks/v31/operations/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..a08e7401
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.json b/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..1c7aed73
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..24c70642
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.json b/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.json
new file mode 100644
index 00000000..3f45a592
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type" : "object",
+ "properties" : { }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.yaml b/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.yaml
new file mode 100644
index 00000000..5cdefc1a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/with-properties-empty.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+ properties: {}
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-data.json b/src/test/resources/checks/v31/operations/OAR038/without-data.json
new file mode 100644
index 00000000..de142681
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-data.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-data.yaml b/src/test/resources/checks/v31/operations/OAR038/without-data.yaml
new file mode 100644
index 00000000..ced39065
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-data.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-properties.json b/src/test/resources/checks/v31/operations/OAR038/without-properties.json
new file mode 100644
index 00000000..bc549d80
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-properties.json
@@ -0,0 +1,53 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "post": {
+ "responses": {
+ "201": {
+ "$ref": "#/components/responses/createResponse"
+ },
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/post_response"
+ }
+ ]
+ },
+ "post_response": {
+ "type": "object",
+ "properties": {
+ "data": { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type": "object"
+ }
+ }
+ }
+ },
+ "responses": {
+ "createResponse": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-properties.yaml b/src/test/resources/checks/v31/operations/OAR038/without-properties.yaml
new file mode 100644
index 00000000..50fb5b62
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-properties.yaml
@@ -0,0 +1,33 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ $ref: '#/components/responses/createResponse'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/post_response'
+
+ post_response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+
+ responses:
+ createResponse:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-schema.json b/src/test/resources/checks/v31/operations/OAR038/without-schema.json
new file mode 100644
index 00000000..4ac5063e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-schema.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR038: Response schema is required}}
+ "description" : "Ok"
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR038/without-schema.yaml b/src/test/resources/checks/v31/operations/OAR038/without-schema.yaml
new file mode 100644
index 00000000..9eecdf8a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR038/without-schema.yaml
@@ -0,0 +1,12 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR038: Response schema is required}}
+ description: Ok
+ 204:
+ description: No content
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR039/missing-codes.json b/src/test/resources/checks/v31/operations/OAR039/missing-codes.json
new file mode 100644
index 00000000..18cf09e2
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR039/missing-codes.json
@@ -0,0 +1,109 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "put": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "patch": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "delete": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR039/missing-codes.yaml b/src/test/resources/checks/v31/operations/OAR039/missing-codes.yaml
new file mode 100644
index 00000000..da2618e7
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR039/missing-codes.yaml
@@ -0,0 +1,68 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ put:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ patch:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ delete:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR039/valid.json b/src/test/resources/checks/v31/operations/OAR039/valid.json
new file mode 100644
index 00000000..aa5bfe3b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR039/valid.json
@@ -0,0 +1,283 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Partial collection"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR039/valid.yaml b/src/test/resources/checks/v31/operations/OAR039/valid.yaml
new file mode 100644
index 00000000..5f7621b2
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR039/valid.yaml
@@ -0,0 +1,184 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Partial collection
+ 400:
+ description: Bad request
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ put:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ patch:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ delete:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner:
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR045/defined-response.json b/src/test/resources/checks/v31/operations/OAR045/defined-response.json
new file mode 100644
index 00000000..b73d9c78
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR045/defined-response.yaml b/src/test/resources/checks/v31/operations/OAR045/defined-response.yaml
new file mode 100644
index 00000000..6540560a
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v31/operations/OAR046/declared-tag.json b/src/test/resources/checks/v31/operations/OAR046/declared-tag.json
new file mode 100644
index 00000000..ba269228
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR046/declared-tag.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag" ],
+ "responses" : { }
+ },
+ "post" : { # Noncompliant {{OAR046: Associate a tag to this operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR046/declared-tag.yaml b/src/test/resources/checks/v31/operations/OAR046/declared-tag.yaml
new file mode 100644
index 00000000..ad2e2943
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR046/declared-tag.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ responses: {}
+ post: # Noncompliant {{OAR046: Associate a tag to this operation}}
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR048/many-body-params.json b/src/test/resources/checks/v31/operations/OAR048/many-body-params.json
new file mode 100644
index 00000000..27c7c9ef
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR048/many-body-params.json
@@ -0,0 +1,75 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "responses": {
+ "default": {
+ "description": "the default response"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR048: An operation can have at most one body parameter}}
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "otherParam": {
+ "type": "string"
+ }
+ },
+ "required": ["otherParam"]
+ }
+ }
+ }
+ },
+ "x-extraRequestBody": {
+ "description": "Simulated second body param (invalid by spec)",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "toto": {
+ "type": "string"
+ }
+ },
+ "required": ["toto"]
+ }
+ }
+ }
+ },
+ "responses": {
+ "default": {
+ "description": "the default response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Used": {
+ "type": "string"
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/operations/OAR048/many-body-params.yaml b/src/test/resources/checks/v31/operations/OAR048/many-body-params.yaml
new file mode 100644
index 00000000..16c23f86
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR048/many-body-params.yaml
@@ -0,0 +1,47 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: string
+ responses:
+ default:
+ description: the default response
+ post: # Noncompliant {{OAR048: An operation can have at most one body parameter}}
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ otherParam:
+ type: string
+ required:
+ - otherParam
+ x-extraRequestBody:
+ description: Simulated second body param (invalid by spec)
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ toto:
+ type: string
+ required:
+ - toto
+ responses:
+ default:
+ description: the default response
+components:
+ schemas:
+ Used:
+ type: string
diff --git a/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.json b/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.json
new file mode 100644
index 00000000..250fc7cc
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "get": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR061: Response code 200, 202, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.yaml b/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.yaml
new file mode 100644
index 00000000..89ebbce6
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR061/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ get:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ get:
+ summary: Get all users
+ responses: # Noncompliant {{OAR061: Response code 200, 202, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR061/valid.json b/src/test/resources/checks/v31/operations/OAR061/valid.json
new file mode 100644
index 00000000..4cf7cc59
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR061/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR061/valid.yaml b/src/test/resources/checks/v31/operations/OAR061/valid.yaml
new file mode 100644
index 00000000..b6412fa3
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR061/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ get:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.json b/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.json
new file mode 100644
index 00000000..54b242b4
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "post": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "post": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "post": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR062: Response code 200, 201, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.yaml b/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.yaml
new file mode 100644
index 00000000..7af54946
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR062/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ post:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ post:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ post:
+ summary: Get all users
+ responses: # Noncompliant {{OAR062: Response code 200, 201, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR062/valid.json b/src/test/resources/checks/v31/operations/OAR062/valid.json
new file mode 100644
index 00000000..e282f658
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR062/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "post": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "post": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR062/valid.yaml b/src/test/resources/checks/v31/operations/OAR062/valid.yaml
new file mode 100644
index 00000000..e4a5ed0b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR062/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ post:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ post:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.json b/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.json
new file mode 100644
index 00000000..79ce1629
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "put": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "put": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "put": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR063: Response code 200, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.yaml b/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.yaml
new file mode 100644
index 00000000..1ce595a9
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR063/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ put:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ put:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ put:
+ summary: Get all users
+ responses: # Noncompliant {{OAR063: Response code 200, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR063/valid.json b/src/test/resources/checks/v31/operations/OAR063/valid.json
new file mode 100644
index 00000000..657750f3
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR063/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "put": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "put": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR063/valid.yaml b/src/test/resources/checks/v31/operations/OAR063/valid.yaml
new file mode 100644
index 00000000..d165ef82
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR063/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ put:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ put:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.json b/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.json
new file mode 100644
index 00000000..1027f256
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "patch": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "patch": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "patch": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR064: Response code 200, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.yaml b/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.yaml
new file mode 100644
index 00000000..74e5c6ee
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR064/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ patch:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ patch:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ patch:
+ summary: Get all users
+ responses: # Noncompliant {{OAR064: Response code 200, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR064/valid.json b/src/test/resources/checks/v31/operations/OAR064/valid.json
new file mode 100644
index 00000000..ca44dca1
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR064/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "patch": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "patch": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR064/valid.yaml b/src/test/resources/checks/v31/operations/OAR064/valid.yaml
new file mode 100644
index 00000000..74def602
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR064/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ patch:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ patch:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.json b/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.json
new file mode 100644
index 00000000..4192edaf
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "delete": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR065: Response code 200, 202, 204 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.yaml b/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.yaml
new file mode 100644
index 00000000..d5f09172
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR065/insuficent-response-codes.yaml
@@ -0,0 +1,24 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ delete:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ delete:
+ summary: Get all users
+ responses: # Noncompliant {{OAR065: Response code 200, 202, 204 must be defined}}
+ 400:
+ description: Error
+
diff --git a/src/test/resources/checks/v31/operations/OAR065/valid.json b/src/test/resources/checks/v31/operations/OAR065/valid.json
new file mode 100644
index 00000000..395464f8
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR065/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR065/valid.yaml b/src/test/resources/checks/v31/operations/OAR065/valid.yaml
new file mode 100644
index 00000000..cac7aad6
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR065/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ delete:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v31/operations/OAR071/missing-query-params.json b/src/test/resources/checks/v31/operations/OAR071/missing-query-params.json
new file mode 100644
index 00000000..c90d3c5d
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR071/missing-query-params.json
@@ -0,0 +1,59 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [ # Noncompliant {{OAR071: Query parameters param3 must be defined}}
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "param4",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param5",
+ "in": "query",
+ "schema": {
+ "type": "number"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR071/missing-query-params.yaml b/src/test/resources/checks/v31/operations/OAR071/missing-query-params.yaml
new file mode 100644
index 00000000..952b888e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR071/missing-query-params.yaml
@@ -0,0 +1,34 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters: # Noncompliant {{OAR071: Query parameters param3 must be defined}}
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ - name: param4
+ in: query
+ schema:
+ type: string
+ - name: param5
+ in: query
+ schema:
+ type: number
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR071/valid-query-params.json b/src/test/resources/checks/v31/operations/OAR071/valid-query-params.json
new file mode 100644
index 00000000..66335243
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR071/valid-query-params.json
@@ -0,0 +1,66 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "param3",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "param4",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param5",
+ "in": "query",
+ "schema": {
+ "type": "number"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR071/valid-query-params.yaml b/src/test/resources/checks/v31/operations/OAR071/valid-query-params.yaml
new file mode 100644
index 00000000..ec932c65
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR071/valid-query-params.yaml
@@ -0,0 +1,38 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ - name: param4
+ in: query
+ schema:
+ type: string
+ - name: param5
+ in: query
+ schema:
+ type: number
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR091/no-ref.json b/src/test/resources/checks/v31/operations/OAR091/no-ref.json
new file mode 100644
index 00000000..e7add18e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR091/no-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "parameters": [ # Noncompliant {{OAR091: Parameters must contain only references ($ref)}}
+ {
+ "name": "user",
+ "in": "query",
+ "description": "User information",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR091/no-ref.yaml b/src/test/resources/checks/v31/operations/OAR091/no-ref.yaml
new file mode 100644
index 00000000..29dd6c9e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR091/no-ref.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ parameters: # Noncompliant {{OAR091: Parameters must contain only references ($ref)}}
+ - name: user
+ in: query
+ description: User information
+ required: true
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
+ responses:
+ '200':
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR091/with-ref.json b/src/test/resources/checks/v31/operations/OAR091/with-ref.json
new file mode 100644
index 00000000..f5e72fdd
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR091/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/UserParam"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "UserParam": {
+ "name": "user",
+ "in": "query",
+ "description": "User information",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR091/with-ref.yaml b/src/test/resources/checks/v31/operations/OAR091/with-ref.yaml
new file mode 100644
index 00000000..96c8e0f4
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR091/with-ref.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/UserParam'
+ responses:
+ '200':
+ description: Successful response
+components:
+ parameters:
+ UserParam:
+ name: user
+ in: query
+ description: User information
+ required: true
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR092/no-ref.json b/src/test/resources/checks/v31/operations/OAR092/no-ref.json
new file mode 100644
index 00000000..8bedb1ff
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR092/no-ref.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "summary": "Create a pet",
+ "requestBody": { # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ "description": "The pet to create",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet created successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR092/no-ref.yaml b/src/test/resources/checks/v31/operations/OAR092/no-ref.yaml
new file mode 100644
index 00000000..60291f6e
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR092/no-ref.yaml
@@ -0,0 +1,579 @@
+openapi: "3.1.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ description: API de ejemplo para pruebas
+ contact:
+ name: Nombre del Contacto
+ email: contact@mail.com
+ version: 1.0.0
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ description: Método que permite obtener un listado con datos básicos de un usuario
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '500'
+ message: Internal server error
+ path: /datos-usuario
+ type: https://docs.example.es/x/5008Aw
+ operationId: '10004'
+ errors:
+ - code: '501'
+ message: Internal server error
+ post:
+ summary: Alta de los datos de un usuario
+ description: Método que permite dar de alta los datos básicos de un usuario
+ requestBody: # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ description: Datos del usuario
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ responses:
+ '201':
+ description: OK
+ headers:
+ location:
+ description: RFC 7231 - The new resource which was created by the request.
+ schema:
+ type: string
+ example: /datos-usuarios/a2649c29-48c6-4c48-b64d-0455346efbbd
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: emailUsuario
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '500'
+ message: Internal server error
+ path: /datos-usuario
+ type: https://docs.example.es/x/5008Aw
+ operationId: '10004'
+ errors:
+ - code: '501'
+ message: Internal server error
+ x-codegen-request-body-name: body
+ /datos-usuarios/{idUsuario}:
+ get:
+ summary: Recuperación de los datos de un usuario por su id
+ description: >-
+ Método que permite recuperar la información básica de un usuario por su
+ id
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10001'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '404'
+ message: Not found
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10002'
+ errors:
+ - code: '102'
+ message: Entity not found
+ location: idUsuario
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ put:
+ summary: Modificación de los datos de un usuario
+ description: Método que permite modificar los datos básicos de un usuario
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ requestBody: # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ description: Datos del usuario
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10002'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ x-codegen-request-body-name: body
+ delete:
+ summary: Borrado de los datos de un usuario
+ description: Método que permite borrar los datos básicos de un usuario
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ responses:
+ '204':
+ description: No content
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10003'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ datosUsuario:
+ title: datosUsuario
+ type: object
+ required:
+ - nombreUsuario
+ - emailUsuario
+ properties:
+ idUsuario:
+ type: string
+ description: ID del usuario
+ example: '12'
+ readOnly: true
+ nombreUsuario:
+ type: string
+ description: Nombre del usuario
+ minLength: 5
+ maxLength: 255
+ example: Pedro
+ emailUsuario:
+ type: string
+ description: Email del usuario
+ minLength: 5
+ maxLength: 255
+ example: pedro@mail.com
+ fechaNacimiento:
+ type: string
+ description: Fecha de nacimiento
+ format: date
+ example: 1980-10-11T00:00:00.000Z
+ alta:
+ type: string
+ description: Fecha de alta
+ format: date-time
+ example: 2022-05-10T12:00:27.870Z
+ description: Datos básicos de un usuario
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción.
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: >-
+ Listado de suberrores usado para dar información más detallada, como
+ en el caso de errores de validación.
+ items:
+ $ref: '#/components/schemas/errors'
+ description: Datamodel refleja el formato de respuesta de error
+ errors:
+ required:
+ - message
+ type: object
+ properties:
+ message:
+ type: string
+ description: Detalle del suberror.
+ code:
+ type: string
+ description: Código de error (en errores de validación indica el tipo de error).
+ location:
+ type: string
+ description: >-
+ Localización del error (en errores de validación indica el campo
+ donde se produce el error).
+ description: >-
+ Listado de suberrores usado para dar información más detallada, como en
+ el caso de errores de validación.
diff --git a/src/test/resources/checks/v31/operations/OAR092/with-ref.json b/src/test/resources/checks/v31/operations/OAR092/with-ref.json
new file mode 100644
index 00000000..edf695d4
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR092/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "summary": "Create a pet",
+ "requestBody": {
+ "$ref": "#/components/requestBodies/Pet"
+ },
+ "responses": {
+ "201": {
+ "description": "Pet created successfully"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "Pet": {
+ "description": "The pet to create",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR092/with-ref.yaml b/src/test/resources/checks/v31/operations/OAR092/with-ref.yaml
new file mode 100644
index 00000000..ddcdf1b6
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR092/with-ref.yaml
@@ -0,0 +1,33 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: '1.0.0'
+paths:
+ /pets:
+ post:
+ summary: Create a pet
+ requestBody:
+ $ref: '#/components/requestBodies/PetBody'
+ responses:
+ '201':
+ description: Pet created successfully
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+components:
+ requestBodies:
+ PetBody:
+ description: The pet to create
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR093/no-ref.json b/src/test/resources/checks/v31/operations/OAR093/no-ref.json
new file mode 100644
index 00000000..a32c7a39
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR093/no-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Get all pets",
+ "responses": { # Noncompliant {{OAR093: Responses must contain only references ($ref)}}
+ "200": {
+ "description": "A list of pets",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR093/no-ref.yaml b/src/test/resources/checks/v31/operations/OAR093/no-ref.yaml
new file mode 100644
index 00000000..246e039d
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR093/no-ref.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Get all pets
+ responses: # Noncompliant {{OAR093: Responses must contain only references ($ref)}}
+ '200':
+ description: A list of pets
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR093/with-ref.json b/src/test/resources/checks/v31/operations/OAR093/with-ref.json
new file mode 100644
index 00000000..31a42d87
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR093/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Get all pets",
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/AllPets"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "AllPets": {
+ "description": "A list of pets",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR093/with-ref.yaml b/src/test/resources/checks/v31/operations/OAR093/with-ref.yaml
new file mode 100644
index 00000000..c899dcab
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR093/with-ref.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Get all pets
+ responses:
+ '200':
+ $ref: '#/components/responses/AllPets'
+components:
+ responses:
+ AllPets:
+ description: A list of pets
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR103/plain.json b/src/test/resources/checks/v31/operations/OAR103/plain.json
new file mode 100644
index 00000000..2df241d0
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR103/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (GETs only)"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR103: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR103: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR103/plain.yaml b/src/test/resources/checks/v31/operations/OAR103/plain.yaml
new file mode 100644
index 00000000..72e3afdd
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR103/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (GETs only)
+paths:
+ /resources:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ get: # Noncompliant {{OAR103: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{delete}:
+ get: # Noncompliant {{OAR103: Operation not recommended for resource path: resources/{delete}}}
+ responses:
+ '200':
+ description: Ok
+ /hola/{r_id}/other:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ get:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR104/plain.yaml b/src/test/resources/checks/v31/operations/OAR104/plain.yaml
new file mode 100644
index 00000000..a55e6d78
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR104/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.1.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/me/cars:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ post: # Noncompliant {{OAR104: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/hello:
+ post: # Noncompliant {{OAR104: Operation not recommended for resource path: resources/hello}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/search:
+ post:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR105/plain.json b/src/test/resources/checks/v31/operations/OAR105/plain.json
new file mode 100644
index 00000000..08acb742
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR105/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "put": { # Noncompliant {{OAR105: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "put": { # Noncompliant {{OAR105: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR105/plain.yaml b/src/test/resources/checks/v31/operations/OAR105/plain.yaml
new file mode 100644
index 00000000..8ea22b04
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR105/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ put: # Noncompliant {{OAR105: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ put: # Noncompliant {{OAR105: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ put:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR106/plain.json b/src/test/resources/checks/v31/operations/OAR106/plain.json
new file mode 100644
index 00000000..d0a5d86b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR106/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "patch": { # Noncompliant {{OAR106: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "patch": { # Noncompliant {{OAR106: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR106/plain.yaml b/src/test/resources/checks/v31/operations/OAR106/plain.yaml
new file mode 100644
index 00000000..28bb3ef6
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR106/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ patch: # Noncompliant {{OAR106: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ patch: # Noncompliant {{OAR106: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ patch:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR107/plain.json b/src/test/resources/checks/v31/operations/OAR107/plain.json
new file mode 100644
index 00000000..848c07b5
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR107/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "delete": { # Noncompliant {{OAR107: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "delete": { # Noncompliant {{OAR107: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR107/plain.yaml b/src/test/resources/checks/v31/operations/OAR107/plain.yaml
new file mode 100644
index 00000000..0ac22415
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR107/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ delete: # Noncompliant {{OAR107: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ delete: # Noncompliant {{OAR107: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ delete:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR109/plain.json b/src/test/resources/checks/v31/operations/OAR109/plain.json
new file mode 100644
index 00000000..c5f4cc3b
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR109/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "delete": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR109: Use default instead of directly specifying 5XX codes}}
+ "400": {
+ "description": "Error"
+ },
+ "500": {
+ "description": "Internal Server Error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/operations/OAR109/plain.yaml b/src/test/resources/checks/v31/operations/OAR109/plain.yaml
new file mode 100644
index 00000000..16518e02
--- /dev/null
+++ b/src/test/resources/checks/v31/operations/OAR109/plain.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ '400':
+ description: error
+ /another:
+ delete:
+ summary: Get another API status
+ responses:
+ '400':
+ description: error
+ /users:
+ delete:
+ summary: Get all users
+ responses: # Noncompliant {{OAR109: Use default instead of directly specifying 5XX codes}}
+ '400':
+ description: Error
+ '500':
+ description: Internal Server Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR070/no-numeric.json b/src/test/resources/checks/v31/owasp/OAR070/no-numeric.json
new file mode 100644
index 00000000..aa8bac1d
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR070/no-numeric.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items/{param1}": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR070/no-numeric.yaml b/src/test/resources/checks/v31/owasp/OAR070/no-numeric.yaml
new file mode 100644
index 00000000..549c62c3
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR070/no-numeric.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.1.0"
+ info:
+ version: 1.0.0
+ title: Swagger Petstore
+ paths:
+ /items/{param1}:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR070/numeric.json b/src/test/resources/checks/v31/owasp/OAR070/numeric.json
new file mode 100644
index 00000000..98ba2b76
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR070/numeric.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items/{param1}": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "integer" # Noncompliant {{OAR070: Parameters in path shouldnt be numeric}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR070/numeric.yaml b/src/test/resources/checks/v31/owasp/OAR070/numeric.yaml
new file mode 100644
index 00000000..8c4d10ad
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR070/numeric.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.1.0"
+ info:
+ version: 1.0.0
+ title: Swagger Petstore
+ paths:
+ /items/{param1}:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: integer # Noncompliant {{OAR070: Parameters in path shouldnt be numeric}}
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.json b/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.json
new file mode 100644
index 00000000..247b5684
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.json
@@ -0,0 +1,57 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Health Check Excluded Paths API"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Health check - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health": {
+ "get": {
+ "summary": "Health endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health-check": {
+ "get": {
+ "summary": "Health check endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/ping": {
+ "get": {
+ "summary": "Ping endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/liveness": {
+ "get": {
+ "summary": "Liveness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/readiness": {
+ "get": {
+ "summary": "Readiness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.yaml b/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.yaml
new file mode 100644
index 00000000..49ed31d1
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/health-check-excluded.yaml
@@ -0,0 +1,41 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Health Check Excluded Paths API
+paths:
+ /status:
+ get:
+ summary: Health check - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health:
+ get:
+ summary: Health endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health-check:
+ get:
+ summary: Health check endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /ping:
+ get:
+ summary: Ping endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /liveness:
+ get:
+ summary: Liveness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /readiness:
+ get:
+ summary: Readiness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.json b/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.json
new file mode 100644
index 00000000..6518d062
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.json
@@ -0,0 +1,29 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Non-compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": { # Noncompliant {{OAR073: API should include a 429 response to indicate rate limiting}}
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.yaml b/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.yaml
new file mode 100644
index 00000000..3a7d6e14
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/no-rate-limit.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Non-compliant API
+paths:
+ /param2:
+ get:
+ summary: Get a list of items
+ responses: # Noncompliant {{OAR073: API should include a 429 response to indicate rate limiting}}
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR073/no-responses.json b/src/test/resources/checks/v31/owasp/OAR073/no-responses.json
new file mode 100644
index 00000000..66ce8dc7
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/no-responses.json
@@ -0,0 +1,14 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items with no responses key"
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/owasp/OAR073/no-responses.yaml b/src/test/resources/checks/v31/owasp/OAR073/no-responses.yaml
new file mode 100644
index 00000000..100aac36
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/no-responses.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Compliant API
+paths:
+ /items:
+ get:
+ summary: Get a list of items with no responses key
diff --git a/src/test/resources/checks/v31/owasp/OAR073/rate-limit.json b/src/test/resources/checks/v31/owasp/OAR073/rate-limit.json
new file mode 100644
index 00000000..1c80ee0b
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/rate-limit.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "429": {
+ "description": "Too Many Requests",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/error_response"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/owasp/OAR073/rate-limit.yaml b/src/test/resources/checks/v31/owasp/OAR073/rate-limit.yaml
new file mode 100644
index 00000000..52e29e1e
--- /dev/null
+++ b/src/test/resources/checks/v31/owasp/OAR073/rate-limit.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Compliant API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 429:
+ description: Too Many Requests
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/error_response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.json
new file mode 100644
index 00000000..292760a3
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "select" : {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/select"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.yaml
new file mode 100644
index 00000000..7dd092c2
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ select:
+ in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/select'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR019/with-$ref.json
new file mode 100644
index 00000000..6104acb4
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "select" : {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/select"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR019/with-$ref.yaml
new file mode 100644
index 00000000..9fadc127
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ select:
+ in: query
+ name: $select
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/select'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-param.json b/src/test/resources/checks/v31/parameters/OAR019/with-param.json
new file mode 100644
index 00000000..98bed098
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-param.yaml b/src/test/resources/checks/v31/parameters/OAR019/with-param.yaml
new file mode 100644
index 00000000..73ffc8cc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-ref.json b/src/test/resources/checks/v31/parameters/OAR019/with-ref.json
index 6cc45fd4..cfdbbe8e 100644
--- a/src/test/resources/checks/v31/parameters/OAR019/with-ref.json
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-ref.json
@@ -1,5 +1,5 @@
{
- "openapi": "3.1.0",
+ "openapi" : "3.1.0",
"info": {
"version": "1.0.0",
"title": "Swagger Petstore"
diff --git a/src/test/resources/checks/v31/parameters/OAR019/with-ref.yaml b/src/test/resources/checks/v31/parameters/OAR019/with-ref.yaml
index ae167749..8fdd9227 100644
--- a/src/test/resources/checks/v31/parameters/OAR019/with-ref.yaml
+++ b/src/test/resources/checks/v31/parameters/OAR019/with-ref.yaml
@@ -1,4 +1,4 @@
-openapi: 3.1.0
+openapi: "3.1.0"
info:
version: 1.0.0
title: Swagger Petstore
diff --git a/src/test/resources/checks/v31/parameters/OAR019/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR019/without-parameters.json
new file mode 100644
index 00000000..c91042b4
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR019/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR019/without-parameters.yaml
new file mode 100644
index 00000000..80561084
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR019/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/excluded.json b/src/test/resources/checks/v31/parameters/OAR020/excluded.json
new file mode 100644
index 00000000..cd74ed03
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR020/excluded.yaml
new file mode 100644
index 00000000..b3d500eb
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/excluded2.json b/src/test/resources/checks/v31/parameters/OAR020/excluded2.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/excluded2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/excluded2.yaml b/src/test/resources/checks/v31/parameters/OAR020/excluded2.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/excluded2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.json b/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.json
new file mode 100644
index 00000000..ae97bec9
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "expand",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.yaml b/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.yaml
new file mode 100644
index 00000000..1d91fe46
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/expand-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain-without.json b/src/test/resources/checks/v31/parameters/OAR020/plain-without.json
new file mode 100644
index 00000000..d9ee579e
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR020/plain-without.yaml
new file mode 100644
index 00000000..dde9ca94
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain-without2.json b/src/test/resources/checks/v31/parameters/OAR020/plain-without2.json
new file mode 100644
index 00000000..654e495d
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain-without2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain-without2.yaml b/src/test/resources/checks/v31/parameters/OAR020/plain-without2.yaml
new file mode 100644
index 00000000..6a37c815
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain-without2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain.json b/src/test/resources/checks/v31/parameters/OAR020/plain.json
new file mode 100644
index 00000000..76d1f1b6
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain.yaml b/src/test/resources/checks/v31/parameters/OAR020/plain.yaml
new file mode 100644
index 00000000..8f3532ee
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain2.json b/src/test/resources/checks/v31/parameters/OAR020/plain2.json
new file mode 100644
index 00000000..d29027c7
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/plain2.yaml b/src/test/resources/checks/v31/parameters/OAR020/plain2.yaml
new file mode 100644
index 00000000..4fef92c5
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/plain2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.json
new file mode 100644
index 00000000..e73bb0a3
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "expand" : {
+ "in" : "query",
+ "name" : "expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/expand"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.yaml
new file mode 100644
index 00000000..901c6c9b
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ expand:
+ in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/expand'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR020/with-$ref.json
new file mode 100644
index 00000000..d3290cbc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "expand" : {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/expand"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR020/with-$ref.yaml
new file mode 100644
index 00000000..685b73dc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ expand:
+ in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/expand'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-param.json b/src/test/resources/checks/v31/parameters/OAR020/with-param.json
new file mode 100644
index 00000000..98bed098
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-param.yaml b/src/test/resources/checks/v31/parameters/OAR020/with-param.yaml
new file mode 100644
index 00000000..73ffc8cc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-ref.json b/src/test/resources/checks/v31/parameters/OAR020/with-ref.json
new file mode 100644
index 00000000..ff4aa030
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "selectParameter": {
+ "in": "query",
+ "name": "$expand",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/selectParameter"
+ }
+ ],
+ "responses": {
+ "206": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/with-ref.yaml b/src/test/resources/checks/v31/parameters/OAR020/with-ref.yaml
new file mode 100644
index 00000000..16d2246f
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/with-ref.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ parameters:
+ selectParameter:
+ in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/selectParameter'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR020/without-parameters.json
new file mode 100644
index 00000000..9d16a3ef
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR020/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR020/without-parameters.yaml
new file mode 100644
index 00000000..f16d31f9
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR020/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.json b/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.json
new file mode 100644
index 00000000..52d848b5
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "exclude",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.yaml b/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.yaml
new file mode 100644
index 00000000..0a3b5a2c
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/exclude-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR021/excluded.json b/src/test/resources/checks/v31/parameters/OAR021/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR021/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/plain-without.json b/src/test/resources/checks/v31/parameters/OAR021/plain-without.json
new file mode 100644
index 00000000..3e134736
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR021/plain-without.yaml
new file mode 100644
index 00000000..917b9693
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/plain.json b/src/test/resources/checks/v31/parameters/OAR021/plain.json
new file mode 100644
index 00000000..ae8fecfb
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/plain.yaml b/src/test/resources/checks/v31/parameters/OAR021/plain.yaml
new file mode 100644
index 00000000..47439ebe
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.json
new file mode 100644
index 00000000..c1deb4db
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "exclude" : {
+ "in" : "query",
+ "name" : "exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/exclude"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.yaml
new file mode 100644
index 00000000..23f92400
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ exclude:
+ in: query
+ name: exclude
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/exclude'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR021/with-$ref.json
new file mode 100644
index 00000000..640ac5c1
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "exclude" : {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/exclude"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR021/with-$ref.yaml
new file mode 100644
index 00000000..abffd701
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ exclude:
+ in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/exclude'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-param.json b/src/test/resources/checks/v31/parameters/OAR021/with-param.json
new file mode 100644
index 00000000..98bed098
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-param.yaml b/src/test/resources/checks/v31/parameters/OAR021/with-param.yaml
new file mode 100644
index 00000000..73ffc8cc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-ref.json b/src/test/resources/checks/v31/parameters/OAR021/with-ref.json
new file mode 100644
index 00000000..518c3c8c
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "selectParameter": {
+ "in": "query",
+ "name": "$exclude",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/selectParameter"
+ }
+ ],
+ "responses": {
+ "206": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/with-ref.yaml b/src/test/resources/checks/v31/parameters/OAR021/with-ref.yaml
new file mode 100644
index 00000000..ff0ae19b
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/with-ref.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ parameters:
+ selectParameter:
+ in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/selectParameter'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR021/without-parameters.json
new file mode 100644
index 00000000..de714e9e
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR021/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR021/without-parameters.yaml
new file mode 100644
index 00000000..b80091fc
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR021/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/excluded.json b/src/test/resources/checks/v31/parameters/OAR022/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR022/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/plain-without.json b/src/test/resources/checks/v31/parameters/OAR022/plain-without.json
new file mode 100644
index 00000000..d7ed379d
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR022/plain-without.yaml
new file mode 100644
index 00000000..ead64c1c
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/plain.json b/src/test/resources/checks/v31/parameters/OAR022/plain.json
new file mode 100644
index 00000000..65fbba98
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/plain.yaml b/src/test/resources/checks/v31/parameters/OAR022/plain.yaml
new file mode 100644
index 00000000..42fb1be4
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.json
new file mode 100644
index 00000000..92208ba0
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.yaml
new file mode 100644
index 00000000..876b37cd
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR022/with-$ref.json
new file mode 100644
index 00000000..4219957b
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR022/with-$ref.yaml
new file mode 100644
index 00000000..8ac1a909
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR022/without-parameters.json
new file mode 100644
index 00000000..42024fdf
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR022/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR022/without-parameters.yaml
new file mode 100644
index 00000000..b6975c61
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/excluded.json b/src/test/resources/checks/v31/parameters/OAR023/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR023/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/plain-without.json b/src/test/resources/checks/v31/parameters/OAR023/plain-without.json
new file mode 100644
index 00000000..5f22df41
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR023/plain-without.yaml
new file mode 100644
index 00000000..07eb9ca0
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/plain.json b/src/test/resources/checks/v31/parameters/OAR023/plain.json
new file mode 100644
index 00000000..db9de69d
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/plain.yaml b/src/test/resources/checks/v31/parameters/OAR023/plain.yaml
new file mode 100644
index 00000000..1cfb12ad
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $total
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.json
new file mode 100644
index 00000000..e82547c6
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.yaml
new file mode 100644
index 00000000..12a75d80
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/with-$ref-without.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR023/with-$ref.json
new file mode 100644
index 00000000..7c1388b1
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/with-$ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR023/with-$ref.yaml
new file mode 100644
index 00000000..985a84f6
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/with-$ref.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR023/without-parameters.json
new file mode 100644
index 00000000..4a939e4d
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR023/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR023/without-parameters.yaml
new file mode 100644
index 00000000..d3754e51
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR023/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/excluded.json b/src/test/resources/checks/v31/parameters/OAR024/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR024/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/plain-without.json b/src/test/resources/checks/v31/parameters/OAR024/plain-without.json
new file mode 100644
index 00000000..b80f1ac8
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR024/plain-without.yaml
new file mode 100644
index 00000000..8dfda543
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/plain.json b/src/test/resources/checks/v31/parameters/OAR024/plain.json
new file mode 100644
index 00000000..69618890
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/plain.yaml b/src/test/resources/checks/v31/parameters/OAR024/plain.yaml
new file mode 100644
index 00000000..42d4d1e9
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $start
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $start
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.json
new file mode 100644
index 00000000..1215bd29
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "init" : {
+ "in" : "query",
+ "name" : "init",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/init"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.yaml
new file mode 100644
index 00000000..56dce587
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/with-$ref-without.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ init:
+ in: query
+ name: init
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/init'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR024/with-$ref.json
new file mode 100644
index 00000000..456a17bf
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/with-$ref.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "init" : {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/init"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR024/with-$ref.yaml
new file mode 100644
index 00000000..25f60835
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ init:
+ in: query
+ name: $start
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/init'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR024/without-parameters.json
new file mode 100644
index 00000000..fffc2673
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR024/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR024/without-parameters.yaml
new file mode 100644
index 00000000..84341362
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR024/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/excluded.json b/src/test/resources/checks/v31/parameters/OAR025/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR025/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/plain-without.json b/src/test/resources/checks/v31/parameters/OAR025/plain-without.json
new file mode 100644
index 00000000..76c976f6
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR025/plain-without.yaml
new file mode 100644
index 00000000..b99a35ce
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/plain.json b/src/test/resources/checks/v31/parameters/OAR025/plain.json
new file mode 100644
index 00000000..96bc8d9a
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/plain.yaml b/src/test/resources/checks/v31/parameters/OAR025/plain.yaml
new file mode 100644
index 00000000..3bf57ba7
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $limit
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $limit
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.json
new file mode 100644
index 00000000..bb12a265
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "limit" : {
+ "in" : "query",
+ "name" : "limit",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/limit"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.yaml
new file mode 100644
index 00000000..004856ac
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/with-$ref-without.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ limit:
+ in: query
+ name: limit
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/limit'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR025/with-$ref.json
new file mode 100644
index 00000000..eec99045
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/with-$ref.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "limit" : {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/limit"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR025/with-$ref.yaml
new file mode 100644
index 00000000..07e6f0c3
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ limit:
+ in: query
+ name: $limit
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/limit'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR025/without-parameters.json
new file mode 100644
index 00000000..631f45d0
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR025/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR025/without-parameters.yaml
new file mode 100644
index 00000000..2b078122
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.json b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.json
new file mode 100644
index 00000000..e1272ccf
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : false
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.yaml b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.yaml
new file mode 100644
index 00000000..4cc63615
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-false.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: boolean
+ default: false
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.json b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.json
new file mode 100644
index 00000000..754e4969
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.yaml b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.yaml
new file mode 100644
index 00000000..9fd69cec
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-with-defval-true.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: boolean
+ default: true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.json b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.json
new file mode 100644
index 00000000..fe56facb
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, { # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.yaml b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.yaml
new file mode 100644
index 00000000..76791b5a
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-with-$total-without-defval.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ name: $total
+ schema:
+ type: boolean
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.json b/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.json
new file mode 100644
index 00000000..663416b5
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.yaml b/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.yaml
new file mode 100644
index 00000000..317179df
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/plain-without-$total.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: total
+ schema:
+ type: boolean
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.json b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.json
new file mode 100644
index 00000000..005f2e55
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : false
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml
new file mode 100644
index 00000000..5f1d91ce
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+ default: false
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.json b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.json
new file mode 100644
index 00000000..dc6e88e2
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml
new file mode 100644
index 00000000..707f7559
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml
@@ -0,0 +1,28 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+ default: true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.json b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.json
new file mode 100644
index 00000000..a550035d
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : { # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.yaml b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.yaml
new file mode 100644
index 00000000..a7888290
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-with-$total-without-defval.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total: # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ in: query
+ name: $total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.json b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.json
new file mode 100644
index 00000000..b248acab
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.yaml b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.yaml
new file mode 100644
index 00000000..6e44d2c0
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/with-$ref-without-$total.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR026/without-parameters.json
new file mode 100644
index 00000000..7c522e05
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR026/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR026/without-parameters.yaml
new file mode 100644
index 00000000..e097d76a
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR026/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/components-param.json b/src/test/resources/checks/v31/parameters/OAR028/components-param.json
new file mode 100644
index 00000000..e2bdbec7
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/components-param.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components" : {
+ "parameters" : {
+ "filterParam" : {
+ "in" : "query",
+ "name" : "$filter",
+ "schema" : {
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [
+ { "$ref" : "#/components/parameters/filterParam" }
+ ],
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR028/components-param.yaml b/src/test/resources/checks/v31/parameters/OAR028/components-param.yaml
new file mode 100644
index 00000000..bb953926
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/components-param.yaml
@@ -0,0 +1,19 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ filterParam:
+ in: query
+ name: $filter
+ schema:
+ type: string
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/filterParam'
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.json b/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.json
new file mode 100644
index 00000000..8d4f6f29
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/orders" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.yaml b/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.yaml
new file mode 100644
index 00000000..e52b9300
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/exclude-noncompliant.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /orders:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR028/excluded.json b/src/test/resources/checks/v31/parameters/OAR028/excluded.json
new file mode 100644
index 00000000..7d8ea3ca
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR028/excluded.yaml
new file mode 100644
index 00000000..67391c40
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/header-ignored.json b/src/test/resources/checks/v31/parameters/OAR028/header-ignored.json
new file mode 100644
index 00000000..4f115962
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/header-ignored.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "header",
+ "name" : "Authorization",
+ "schema" : {
+ "type" : "string"
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR028/header-ignored.yaml b/src/test/resources/checks/v31/parameters/OAR028/header-ignored.yaml
new file mode 100644
index 00000000..21d22719
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/header-ignored.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: header
+ name: Authorization
+ schema:
+ type: string
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.json b/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.json
new file mode 100644
index 00000000..e23d51ba
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "post" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me/settings" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/health" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/ping" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.yaml b/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.yaml
new file mode 100644
index 00000000..927f40dd
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/me-health-ping.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ post:
+ responses:
+ 206:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me/settings:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /health:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /ping:
+ get:
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR028/plain-without.json b/src/test/resources/checks/v31/parameters/OAR028/plain-without.json
new file mode 100644
index 00000000..f265f5d3
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR028/plain-without.yaml b/src/test/resources/checks/v31/parameters/OAR028/plain-without.yaml
new file mode 100644
index 00000000..ef729a42
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR028/plain.json b/src/test/resources/checks/v31/parameters/OAR028/plain.json
new file mode 100644
index 00000000..c7ac1c8a
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/plain.yaml b/src/test/resources/checks/v31/parameters/OAR028/plain.yaml
new file mode 100644
index 00000000..abeb201c
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.json b/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.json
new file mode 100644
index 00000000..2e7ceb26
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.yaml b/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.yaml
new file mode 100644
index 00000000..c092c813
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/with-$ref.json b/src/test/resources/checks/v31/parameters/OAR028/with-$ref.json
new file mode 100644
index 00000000..3d94cde9
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/with-$ref.yaml b/src/test/resources/checks/v31/parameters/OAR028/with-$ref.yaml
new file mode 100644
index 00000000..80841874
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/without-parameters.json b/src/test/resources/checks/v31/parameters/OAR028/without-parameters.json
new file mode 100644
index 00000000..4ab6bba4
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR028/without-parameters.yaml b/src/test/resources/checks/v31/parameters/OAR028/without-parameters.yaml
new file mode 100644
index 00000000..df692e5f
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR028/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR060/required-false.json b/src/test/resources/checks/v31/parameters/OAR060/required-false.json
new file mode 100644
index 00000000..89eadd24
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR060/required-false.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "required": false,
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "required": false,
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR060/required-false.yaml b/src/test/resources/checks/v31/parameters/OAR060/required-false.yaml
new file mode 100644
index 00000000..3c5c725e
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR060/required-false.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR060/required-true.json b/src/test/resources/checks/v31/parameters/OAR060/required-true.json
new file mode 100644
index 00000000..d9ffefcf
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR060/required-true.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "required": true, # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "required": true, # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR060/required-true.yaml b/src/test/resources/checks/v31/parameters/OAR060/required-true.yaml
new file mode 100644
index 00000000..95969ebd
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR060/required-true.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ required: true # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ required: true # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR069/bad-request400.json b/src/test/resources/checks/v31/parameters/OAR069/bad-request400.json
new file mode 100644
index 00000000..f261c775
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR069/bad-request400.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR069/bad-request400.yaml b/src/test/resources/checks/v31/parameters/OAR069/bad-request400.yaml
new file mode 100644
index 00000000..45b5697b
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR069/bad-request400.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: Bad Request
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.json b/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.json
new file mode 100644
index 00000000..574a3b75
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "parameters": [
+ { # Noncompliant {{OAR069: Any param in PATH or QUERY should have a Bad Request (400) response.}}
+ "name": "param1",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.yaml b/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.yaml
new file mode 100644
index 00000000..295d20b5
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR069/no-bad-request400.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ parameters:
+ - name: param1 # Noncompliant {{OAR069: Any param in PATH or QUERY should have a Bad Request (400) response.}}
+ in: query
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
diff --git a/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.json b/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.json
new file mode 100644
index 00000000..fef731dd
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "externalDocs" : {
+ "description" : "lowercase external documentation", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "url" : "https://example.com"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.yaml
new file mode 100644
index 00000000..f70e3a96
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/external-docs-invalid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+externalDocs:
+ description: lowercase external documentation # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ url: https://example.com
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.json b/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.json
new file mode 100644
index 00000000..87c5331d
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "externalDocs" : {
+ "description" : "Valid external documentation",
+ "url" : "https://example.com"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.yaml b/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.yaml
new file mode 100644
index 00000000..2c4b3d10
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/external-docs-valid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+externalDocs:
+ description: Valid external documentation
+ url: https://example.com
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/info-invalid.json b/src/test/resources/checks/v31/regex/OAR112/info-invalid.json
new file mode 100644
index 00000000..4a5eaf0d
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/info-invalid.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0",
+ "description" : "lowercase description" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/info-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/info-invalid.yaml
new file mode 100644
index 00000000..44c1aad7
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/info-invalid.yaml
@@ -0,0 +1,6 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+ description: lowercase description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/minimal.json b/src/test/resources/checks/v31/regex/OAR112/minimal.json
new file mode 100644
index 00000000..055b2896
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/minimal.json
@@ -0,0 +1,8 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/minimal.yaml b/src/test/resources/checks/v31/regex/OAR112/minimal.yaml
new file mode 100644
index 00000000..1e5e454d
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/minimal.yaml
@@ -0,0 +1,5 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/missing-description.json b/src/test/resources/checks/v31/regex/OAR112/missing-description.json
new file mode 100644
index 00000000..22882dfe
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/missing-description.json
@@ -0,0 +1,8 @@
+{
+ "openapi" : "3.1.0",
+ "info" : { # Noncompliant {{OAR112: Expected to find a value but didn't.}}
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/missing-description.yaml b/src/test/resources/checks/v31/regex/OAR112/missing-description.yaml
new file mode 100644
index 00000000..6593b0c5
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/missing-description.yaml
@@ -0,0 +1,5 @@
+openapi: "3.1.0"
+info: # Noncompliant {{OAR112: Expected to find a value but didn't.}}
+ title: Test API
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/operation-invalid.json b/src/test/resources/checks/v31/regex/OAR112/operation-invalid.json
new file mode 100644
index 00000000..a69d8f97
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/operation-invalid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "summary" : "lowercase operation summary", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/operation-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/operation-invalid.yaml
new file mode 100644
index 00000000..6cb615b9
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/operation-invalid.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ summary: lowercase operation summary # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/regex/OAR112/operation-valid.json b/src/test/resources/checks/v31/regex/OAR112/operation-valid.json
new file mode 100644
index 00000000..0633e725
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/operation-valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "summary" : "Valid Operation Summary",
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/operation-valid.yaml b/src/test/resources/checks/v31/regex/OAR112/operation-valid.yaml
new file mode 100644
index 00000000..e80d8333
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/operation-valid.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ summary: Valid Operation Summary
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.json b/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.json
new file mode 100644
index 00000000..ecb86b3e
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "parameters" : [ {
+ "name" : "page",
+ "in" : "query",
+ "description" : "lowercase parameter description", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "schema" : {
+ "type" : "integer"
+ }
+ } ],
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.yaml
new file mode 100644
index 00000000..ea5a1391
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/parameters-invalid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ parameters:
+ - name: page
+ in: query
+ description: lowercase parameter description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ schema:
+ type: integer
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/regex/OAR112/parameters-valid.json b/src/test/resources/checks/v31/regex/OAR112/parameters-valid.json
new file mode 100644
index 00000000..3e3e2c66
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/parameters-valid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "parameters" : [ {
+ "name" : "page",
+ "in" : "query",
+ "description" : "Valid parameter description",
+ "schema" : {
+ "type" : "integer"
+ }
+ } ],
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/parameters-valid.yaml b/src/test/resources/checks/v31/regex/OAR112/parameters-valid.yaml
new file mode 100644
index 00000000..b0e584df
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/parameters-valid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ parameters:
+ - name: page
+ in: query
+ description: Valid parameter description
+ schema:
+ type: integer
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/regex/OAR112/plain.json b/src/test/resources/checks/v31/regex/OAR112/plain.json
new file mode 100644
index 00000000..5213c927
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/regex/OAR112/plain.yaml b/src/test/resources/checks/v31/regex/OAR112/plain.yaml
new file mode 100644
index 00000000..bfddae53
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/plain.yaml
@@ -0,0 +1,46 @@
+openapi: "3.1.0"
+info:
+ title: Ejemplo de API
+ version: 1.0.0
+ description: Una API de ejemplo para ilustrar la estructura de OpenAPI.
+servers:
+ - url: https://api.ejemplo.com/v1
+paths:
+ /usuarios:
+ get:
+ summary: Obtiene una lista de usuarios
+ description: Retorna una lista completa de usuarios registrados.
+ operationId: getUsuarios
+ tags:
+ - Usuarios
+ parameters:
+ - name: "page"
+ in: "query"
+ description: "Número de página para la paginación"
+ required: false
+ schema:
+ type: "integer"
+ format: "int32"
+ responses:
+ '200':
+ description: ana lista de usuarios se retorna en caso de éxito.
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Usuario'
+ '404':
+ description: No se encontraron usuarios.
+components:
+ schemas:
+ Usuario:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ description: El ID único del usuario.
+ nombre:
+ type: string
+ description: El nombre del usuario.
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/regex/OAR112/servers-invalid.json b/src/test/resources/checks/v31/regex/OAR112/servers-invalid.json
new file mode 100644
index 00000000..15a6eb3b
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/servers-invalid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "servers" : [ {
+ "url" : "https://api.example.com",
+ "description" : "lowercase server description" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/servers-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/servers-invalid.yaml
new file mode 100644
index 00000000..48cd017f
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/servers-invalid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com
+ description: lowercase server description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/servers-valid.json b/src/test/resources/checks/v31/regex/OAR112/servers-valid.json
new file mode 100644
index 00000000..43b7a54b
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/servers-valid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "servers" : [ {
+ "url" : "https://api.example.com",
+ "description" : "Valid server description"
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/servers-valid.yaml b/src/test/resources/checks/v31/regex/OAR112/servers-valid.yaml
new file mode 100644
index 00000000..487eeffb
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/servers-valid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com
+ description: Valid server description
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/tags-invalid.json b/src/test/resources/checks/v31/regex/OAR112/tags-invalid.json
new file mode 100644
index 00000000..b044e523
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/tags-invalid.json
@@ -0,0 +1,11 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "tags" : [ {
+ "name" : "invalidTag" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/tags-invalid.yaml b/src/test/resources/checks/v31/regex/OAR112/tags-invalid.yaml
new file mode 100644
index 00000000..30213586
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/tags-invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+tags:
+ - name: invalidTag # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v31/regex/OAR112/tags-valid.json b/src/test/resources/checks/v31/regex/OAR112/tags-valid.json
new file mode 100644
index 00000000..84bc4888
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/tags-valid.json
@@ -0,0 +1,11 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "tags" : [ {
+ "name" : "ValidTag"
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v31/regex/OAR112/tags-valid.yaml b/src/test/resources/checks/v31/regex/OAR112/tags-valid.yaml
new file mode 100644
index 00000000..4759ab3c
--- /dev/null
+++ b/src/test/resources/checks/v31/regex/OAR112/tags-valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.1.0"
+info:
+ title: Test API
+ version: 1.0.0
+tags:
+ - name: ValidTag
+paths: {}
diff --git a/src/test/resources/checks/v31/resources/OAR008/plain.json b/src/test/resources/checks/v31/resources/OAR008/plain.json
new file mode 100644
index 00000000..ba75c15c
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR008/plain.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "patch" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "put" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "delete" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "head" : { # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "options" : { # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR008/plain.yaml b/src/test/resources/checks/v31/resources/OAR008/plain.yaml
new file mode 100644
index 00000000..68060ecc
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR008/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ patch:
+ responses:
+ 200:
+ description: Ok
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+ head: # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+ options: # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+
diff --git a/src/test/resources/checks/v31/resources/OAR013/plain.json b/src/test/resources/checks/v31/resources/OAR013/plain.json
new file mode 100644
index 00000000..f490b2bb
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR013/plain.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : { # Noncompliant {{OAR013: Default response is required}}
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "default" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR013/plain.yaml b/src/test/resources/checks/v31/resources/OAR013/plain.yaml
new file mode 100644
index 00000000..4b796abc
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR013/plain.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR013: Default response is required}}
+ 200:
+ description: Ok
+ post:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR014/plain.json b/src/test/resources/checks/v31/resources/OAR014/plain.json
new file mode 100644
index 00000000..973e4d92
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR014/plain.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR014/plain.yaml b/src/test/resources/checks/v31/resources/OAR014/plain.yaml
new file mode 100644
index 00000000..0e563616
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR014/plain.yaml
@@ -0,0 +1,30 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR015/plain.json b/src/test/resources/checks/v31/resources/OAR015/plain.json
new file mode 100644
index 00000000..28fbb79d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR015/plain.json
@@ -0,0 +1,72 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six/seven": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR015/plain.yaml b/src/test/resources/checks/v31/resources/OAR015/plain.yaml
new file mode 100644
index 00000000..e298945b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR015/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six/seven: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR017/plain.json b/src/test/resources/checks/v31/resources/OAR017/plain.json
new file mode 100644
index 00000000..37d9774d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR017/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/one" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/{one}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/two" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}/three" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}/{three}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR017/plain.yaml b/src/test/resources/checks/v31/resources/OAR017/plain.yaml
new file mode 100644
index 00000000..87dee561
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR017/plain.yaml
@@ -0,0 +1,58 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/me/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/resources/OAR018/plain.json b/src/test/resources/checks/v31/resources/OAR018/plain.json
new file mode 100644
index 00000000..0c894583
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR018/plain.json
@@ -0,0 +1,194 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR018: Operation not recommended for resource path: POST /resources/{r_id}}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR018/plain.yaml b/src/test/resources/checks/v31/resources/OAR018/plain.yaml
new file mode 100644
index 00000000..9245e482
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR018/plain.yaml
@@ -0,0 +1,114 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /resources:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post: # Noncompliant {{OAR018: Operation not recommended for resource path: POST /resources/{r_id}}}
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ patch:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+
+ /resources/get:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/get}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/delete:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}/other:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/no-post.json b/src/test/resources/checks/v31/resources/OAR027/no-post.json
new file mode 100644
index 00000000..eead3f51
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/no-post.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "201" : {
+ "description" : "Found"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/no-post.yaml b/src/test/resources/checks/v31/resources/OAR027/no-post.yaml
new file mode 100644
index 00000000..63054920
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/no-post.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 201:
+ description: Found
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.json b/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.json
new file mode 100644
index 00000000..d1359d6e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : {
+ "Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.yaml b/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.yaml
new file mode 100644
index 00000000..e772b5ce
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-with-location.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers:
+ Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.json b/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.json
new file mode 100644
index 00000000..e62d413a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "X-Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.yaml b/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.yaml
new file mode 100644
index 00000000..8e8b26a3
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-with-other-headers.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ X-Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.json b/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.json
new file mode 100644
index 00000000..efd4f635
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "description" : "Created"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.yaml b/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.yaml
new file mode 100644
index 00000000..33660a6a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-201-without-location.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ description: Created
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-no-201.json b/src/test/resources/checks/v31/resources/OAR027/post-no-201.json
new file mode 100644
index 00000000..361a35ce
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-no-201.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR027/post-no-201.yaml b/src/test/resources/checks/v31/resources/OAR027/post-no-201.yaml
new file mode 100644
index 00000000..efa20b71
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR027/post-no-201.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 200:
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.json b/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.json
new file mode 100644
index 00000000..64c76749
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.json
@@ -0,0 +1,134 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response_result"
+ },
+ {
+ "$ref": "#/components/schemas/standard_response_metadata"
+ }
+ ]
+ },
+ "standard_response_result": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "standard_response_metadata": {
+ "type": "object",
+ "properties": {
+ "metadata": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.yaml b/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.yaml
new file mode 100644
index 00000000..c852082b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-all-of-md.yaml
@@ -0,0 +1,78 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ standard_response_result:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
+ standard_response_metadata:
+ type: object
+ properties:
+ metadata:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-all-of.json b/src/test/resources/checks/v31/resources/OAR029/valid-all-of.json
new file mode 100644
index 00000000..f545bada
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-all-of.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response_result"
+ }, {
+ "$ref" : "#/components/schemas/standard_response_metadata"
+ } ],
+ "required" : [ "status" ]
+ },
+ "standard_response_result" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ },
+ "standard_response_metadata" : {
+ "properties" : {
+ "metadata" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-all-of.yaml b/src/test/resources/checks/v31/resources/OAR029/valid-all-of.yaml
new file mode 100644
index 00000000..96ac8d09
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-all-of.yaml
@@ -0,0 +1,76 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ required:
+ - status
+ standard_response_result:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
+ standard_response_metadata:
+ properties:
+ metadata:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-md.json b/src/test/resources/checks/v31/resources/OAR029/valid-md.json
new file mode 100644
index 00000000..87649d37
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-md.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-md.yaml b/src/test/resources/checks/v31/resources/OAR029/valid-md.yaml
new file mode 100644
index 00000000..613f2f7a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-md.yaml
@@ -0,0 +1,69 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-r.json b/src/test/resources/checks/v31/resources/OAR029/valid-r.json
new file mode 100644
index 00000000..72f20533
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-r.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponseData"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "$ref": "#/components/responses/errorResponse"
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponseData": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponseData": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "errorResponse": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponseData"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid-r.yaml b/src/test/resources/checks/v31/resources/OAR029/valid-r.yaml
new file mode 100644
index 00000000..ecb01a86
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid-r.yaml
@@ -0,0 +1,59 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponseData'
+ 204:
+ description: No content
+ 400:
+ $ref: '#/components/responses/errorResponse'
+ default:
+ description: Unknown
+components:
+ schemas:
+ successResponseData:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponseData:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
+ responses:
+ errorResponse:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponseData'
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid.json b/src/test/resources/checks/v31/resources/OAR029/valid.json
new file mode 100644
index 00000000..4edd28f8
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid.json
@@ -0,0 +1,105 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "status",
+ "data"
+ ]
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/valid.yaml b/src/test/resources/checks/v31/resources/OAR029/valid.yaml
new file mode 100644
index 00000000..5130357e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/valid.yaml
@@ -0,0 +1,69 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ required:
+ - data
+ - status
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.json b/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.json
new file mode 100644
index 00000000..38b0642b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.json
@@ -0,0 +1,88 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer" # Noncompliant {{OAR029: 'code' must be of type string}}
+ },
+ "message": {
+ "type": "integer" # Noncompliant {{OAR029: 'message' must be of type string}}
+ },
+ "details": {
+ "type": "integer" # Noncompliant {{OAR029: 'details' must be of type array}}
+ },
+ "httpStatus": {
+ "type": "string" # Noncompliant {{OAR029: 'httpStatus' must be of type integer}}
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.yaml b/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.yaml
new file mode 100644
index 00000000..be3a4b01
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-with-properties-wrong-type-r.yaml
@@ -0,0 +1,55 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: integer # Noncompliant {{OAR029: 'code' must be of type string}}
+ message:
+ type: integer # Noncompliant {{OAR029: 'message' must be of type string}}
+ details:
+ type: integer # Noncompliant {{OAR029: 'details' must be of type array}}
+ httpStatus:
+ type: string # Noncompliant {{OAR029: 'httpStatus' must be of type integer}}
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.json b/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.json
new file mode 100644
index 00000000..ad6beecf
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.json
@@ -0,0 +1,75 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'details' property is missing}} {{OAR029: 'httpStatus' property is missing}} {{OAR029: 'message' property is missing}}
+ "type": "object",
+ "properties": {},
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.yaml b/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.yaml
new file mode 100644
index 00000000..5d4d980f
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-without-properties-r.yaml
@@ -0,0 +1,47 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'details' property is missing}} {{OAR029: 'httpStatus' property is missing}} {{OAR029: 'message' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - code
+ - message
+ - httpStatus
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.json b/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.json
new file mode 100644
index 00000000..933edd55
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "integer", # Noncompliant {{OAR029: 'error' must be of type object}}
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.yaml b/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.yaml
new file mode 100644
index 00000000..fb5195fc
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-error-wrong-type-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: integer # Noncompliant {{OAR029: 'error' must be of type object}}
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.json b/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.json
new file mode 100644
index 00000000..0f44f2d2
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string" # Noncompliant {{OAR029: 'status' must be of type boolean}}
+ },
+ "http_code": {
+ "type": "string" # Noncompliant {{OAR029: 'http_code' must be of type integer}}
+ },
+ "errors": {
+ "type": "string" # Noncompliant {{OAR029: 'errors' must be of type array}}
+ },
+ "trace_id": {
+ "type": "integer" # Noncompliant {{OAR029: 'trace_id' must be of type string}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.yaml b/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.yaml
new file mode 100644
index 00000000..5905c287
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-with-properties-wrong-type-md.yaml
@@ -0,0 +1,56 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: string # Noncompliant {{OAR029: 'status' must be of type boolean}}
+ http_code:
+ type: string # Noncompliant {{OAR029: 'http_code' must be of type integer}}
+ errors:
+ type: string # Noncompliant {{OAR029: 'errors' must be of type array}}
+ trace_id:
+ type: integer # Noncompliant {{OAR029: 'trace_id' must be of type string}}
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.json b/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.json
new file mode 100644
index 00000000..a491ce6b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.json
@@ -0,0 +1,80 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": { # Noncompliant {{OAR029: 'errors' property is missing}} {{OAR029: 'http_code' property is missing}} {{OAR029: 'status' property is missing}} {{OAR029: 'trace_id' property is missing}}
+ "type": "object",
+ "properties": {
+ },
+ "required": ["http_code", "status", "trace_id"]
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.yaml b/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.yaml
new file mode 100644
index 00000000..792c8b29
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-without-properties-md.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result: # Noncompliant {{OAR029: 'errors' property is missing}} {{OAR029: 'http_code' property is missing}} {{OAR029: 'status' property is missing}} {{OAR029: 'trace_id' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - http_code
+ - status
+ - trace_id
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.json b/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.json
new file mode 100644
index 00000000..41d9c8a3
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "integer", # Noncompliant {{OAR029: 'result' must be of type object}}
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.yaml b/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.yaml
new file mode 100644
index 00000000..6fd77b70
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-result-wrong-type-md.yaml
@@ -0,0 +1,59 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: integer # Noncompliant {{OAR029: 'result' must be of type object}}
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties: {}
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.json b/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.json
new file mode 100644
index 00000000..4490c9de
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.json
@@ -0,0 +1,90 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "boolean" # Noncompliant {{OAR029: 'http_status' must be of type string}}
+ },
+ "code" : {
+ "type" : "string" # Noncompliant {{OAR029: 'code' must be of type integer}}
+ },
+ "errors" : {
+ "type" : "string" # Noncompliant {{OAR029: 'errors' must be of type array}}
+ },
+ "description" : {
+ "type" : "integer" # Noncompliant {{OAR029: 'description' must be of type string}}
+ },
+ "internal_code" : {
+ "type" : "integer" # Noncompliant {{OAR029: 'internal_code' must be of type string}}
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.yaml b/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.yaml
new file mode 100644
index 00000000..4ecd1f33
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-with-properties-wrong-type.yaml
@@ -0,0 +1,59 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: boolean # Noncompliant {{OAR029: 'http_status' must be of type string}}
+ code:
+ type: string # Noncompliant {{OAR029: 'code' must be of type integer}}
+ errors:
+ type: string # Noncompliant {{OAR029: 'errors' must be of type array}}
+ description:
+ type: integer # Noncompliant {{OAR029: 'description' must be of type string}}
+ internal_code:
+ type: integer # Noncompliant {{OAR029: 'internal_code' must be of type string}}
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.json b/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.json
new file mode 100644
index 00000000..c083192e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.json
@@ -0,0 +1,74 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : { # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'description' property is missing}} {{OAR029: 'errors' property is missing}} {{OAR029: 'http_status' property is missing}} {{OAR029: 'internal_code' property is missing}}
+ "type" : "object",
+ "properties" : { },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.yaml b/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.yaml
new file mode 100644
index 00000000..3b2a5f59
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-without-properties.yaml
@@ -0,0 +1,49 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status: # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'description' property is missing}} {{OAR029: 'errors' property is missing}} {{OAR029: 'http_status' property is missing}} {{OAR029: 'internal_code' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.json b/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.json
new file mode 100644
index 00000000..4e13e696
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "integer", # Noncompliant {{OAR029: 'status' must be of type object}}
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.yaml b/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.yaml
new file mode 100644
index 00000000..28a93fc2
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/with-status-wrong-type.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: integer # Noncompliant {{OAR029: 'status' must be of type object}}
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-data-md.json b/src/test/resources/checks/v31/resources/OAR029/without-data-md.json
new file mode 100644
index 00000000..1cf29d2d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-data-md.json
@@ -0,0 +1,103 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR029: 'data' property is missing}}
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-data-md.yaml b/src/test/resources/checks/v31/resources/OAR029/without-data-md.yaml
new file mode 100644
index 00000000..b440a570
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-data-md.yaml
@@ -0,0 +1,61 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'data' property is missing}}
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-data.json b/src/test/resources/checks/v31/resources/OAR029/without-data.json
new file mode 100644
index 00000000..5ff6a704
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-data.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR029: 'data' property is missing}}
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "value" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-data.yaml b/src/test/resources/checks/v31/resources/OAR029/without-data.yaml
new file mode 100644
index 00000000..24440e00
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-data.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'data' property is missing}}
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ value:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-error-r.json b/src/test/resources/checks/v31/resources/OAR029/without-error-r.json
new file mode 100644
index 00000000..967195ea
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-error-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": { # Noncompliant {{OAR029: 'error' property is missing}}
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-error-r.yaml b/src/test/resources/checks/v31/resources/OAR029/without-error-r.yaml
new file mode 100644
index 00000000..90fba77d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-error-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse: # Noncompliant {{OAR029: 'error' property is missing}}
+ type: object
+ properties:
+ result:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-payload-r.json b/src/test/resources/checks/v31/resources/OAR029/without-payload-r.json
new file mode 100644
index 00000000..2b41e69d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-payload-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": { # Noncompliant {{OAR029: 'payload' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-payload-r.yaml b/src/test/resources/checks/v31/resources/OAR029/without-payload-r.yaml
new file mode 100644
index 00000000..fd398716
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-payload-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse: # Noncompliant {{OAR029: 'payload' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.json b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.json
new file mode 100644
index 00000000..b1221148
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.json
@@ -0,0 +1,107 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": ["status"], # Noncompliant {{OAR029: The following fields must be required: http_code, status, trace_id}}
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.yaml b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.yaml
new file mode 100644
index 00000000..93f6b0b3
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-md.yaml
@@ -0,0 +1,64 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required: # Noncompliant {{OAR029: The following fields must be required: http_code, status, trace_id}}
+ - status
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.json b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.json
new file mode 100644
index 00000000..5f407b7f
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.json
@@ -0,0 +1,89 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [ # Noncompliant {{OAR029: The following fields must be required: code, httpStatus, message}}
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.yaml b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.yaml
new file mode 100644
index 00000000..997a6378
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields-r.yaml
@@ -0,0 +1,55 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required: # Noncompliant {{OAR029: The following fields must be required: code, httpStatus, message}}
+ - httpStatus
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields.json b/src/test/resources/checks/v31/resources/OAR029/without-required-fields.json
new file mode 100644
index 00000000..13e2ec6b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status" ] # Noncompliant {{OAR029: The following fields must be required: code, description, errors, http_status}}
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-required-fields.yaml b/src/test/resources/checks/v31/resources/OAR029/without-required-fields.yaml
new file mode 100644
index 00000000..fadbafb1
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-required-fields.yaml
@@ -0,0 +1,63 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required: # Noncompliant {{OAR029: The following fields must be required: code, description, errors, http_status}}
+ - http_status
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-result-md.json b/src/test/resources/checks/v31/resources/OAR029/without-result-md.json
new file mode 100644
index 00000000..6ce97bd2
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-result-md.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR029: 'result' property is missing}}
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "response": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-result-md.yaml b/src/test/resources/checks/v31/resources/OAR029/without-result-md.yaml
new file mode 100644
index 00000000..ff224728
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-result-md.yaml
@@ -0,0 +1,59 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'result' property is missing}}
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ response:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties: {}
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-status.json b/src/test/resources/checks/v31/resources/OAR029/without-status.json
new file mode 100644
index 00000000..758c5545
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-status.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR029: 'status' property is missing}}
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR029/without-status.yaml b/src/test/resources/checks/v31/resources/OAR029/without-status.yaml
new file mode 100644
index 00000000..c16999d5
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR029/without-status.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'status' property is missing}}
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ response:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v31/resources/OAR030/valid.json b/src/test/resources/checks/v31/resources/OAR030/valid.json
new file mode 100644
index 00000000..af20c983
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR030/valid.yaml b/src/test/resources/checks/v31/resources/OAR030/valid.yaml
new file mode 100644
index 00000000..08dbbc2b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.json b/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.json
new file mode 100644
index 00000000..d5a75192
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : { # Noncompliant {{OAR030: Method get must be declared}}
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.yaml b/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.yaml
new file mode 100644
index 00000000..343b365c
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/with-status-without-get.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status: # Noncompliant {{OAR030: Method get must be declared}}
+ post:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR030/without-status.json b/src/test/resources/checks/v31/resources/OAR030/without-status.json
new file mode 100644
index 00000000..840b42bb
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/without-status.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : { # Noncompliant {{OAR030: The path '/status' must be declared}}
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR030/without-status.yaml b/src/test/resources/checks/v31/resources/OAR030/without-status.yaml
new file mode 100644
index 00000000..b59b6167
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR030/without-status.yaml
@@ -0,0 +1,10 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths: # Noncompliant {{OAR030: The path '/status' must be declared}}
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR031/valid.json b/src/test/resources/checks/v31/resources/OAR031/valid.json
new file mode 100644
index 00000000..39bcaae7
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR031/valid.json
@@ -0,0 +1,170 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ },
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Pet created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ },
+ "example": {
+ "size": 2,
+ "pets": [
+ {
+ "name": "Fluffy",
+ "type": "cat"
+ },
+ {
+ "name": "Sparky",
+ "type": "dog"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Fluffy",
+ "type": "cat"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true,
+ "example": 513168138
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "Snow"
+ },
+ "type": {
+ "type": "string",
+ "example": "dog"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": {
+ "type": "integer",
+ "example": 1
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": {
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "example": "Server error"
+ }
+ }
+ },
+ "example": {
+ "error": "Server error"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR031/valid.yaml b/src/test/resources/checks/v31/resources/OAR031/valid.yaml
new file mode 100644
index 00000000..9b68a04e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR031/valid.yaml
@@ -0,0 +1,113 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ 201:
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pet'
+ example:
+ name: Puppy
+ type: dog
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+ get:
+ responses:
+ 204:
+ description: No content
+ 206:
+ description: Pet created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ example:
+ size: 2
+ pets:
+ - name: Fluffy
+ type: cat
+ - name: Sparky
+ type: dog
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200:
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Fluffy
+ type: cat
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ example: 513168138
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+
+ schemas:
+ pet:
+ type: object
+ properties:
+ name:
+ type: string
+ example: "Snow"
+ type:
+ type: string
+ example: "dog"
+ pets:
+ type: object
+ properties:
+ size:
+ type: integer
+ example: 1
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error:
+ type: string
+ example: "Server error"
+ example:
+ error: "Server error"
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR031/without-examples.json b/src/test/resources/checks/v31/resources/OAR031/without-examples.json
new file mode 100644
index 00000000..444db64d
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR031/without-examples.json
@@ -0,0 +1,120 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "parameters": [
+ { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "query",
+ "name": "$start",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ },
+ "type": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "integer"
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR031/without-examples.yaml b/src/test/resources/checks/v31/resources/OAR031/without-examples.yaml
new file mode 100644
index 00000000..5fa170e9
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR031/without-examples.yaml
@@ -0,0 +1,73 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ parameters:
+ - in: query # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: $start
+ schema:
+ type: integer
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+ schemas:
+ pet:
+ type: object
+ properties:
+ name: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ type: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ pets:
+ type: object
+ properties:
+ size: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: integer
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR032/forbidden-names.json b/src/test/resources/checks/v31/resources/OAR032/forbidden-names.json
new file mode 100644
index 00000000..401f94be
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR032/forbidden-names.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/elements" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/a/nested/items" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/another/{param}/with/valores" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR032/forbidden-names.yaml b/src/test/resources/checks/v31/resources/OAR032/forbidden-names.yaml
new file mode 100644
index 00000000..7810e795
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR032/forbidden-names.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /elements: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /a/nested/items: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /another/{param}/with/valores: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR032/valid.json b/src/test/resources/checks/v31/resources/OAR032/valid.json
new file mode 100644
index 00000000..9cfe7d75
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR032/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{elements}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR032/valid.yaml b/src/test/resources/checks/v31/resources/OAR032/valid.yaml
new file mode 100644
index 00000000..eae1ceba
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR032/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{elements}:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/valid-all-of.json b/src/test/resources/checks/v31/resources/OAR034/valid-all-of.json
new file mode 100644
index 00000000..972429c5
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/valid-all-of.json
@@ -0,0 +1,126 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "first": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "previous": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "next": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "last": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/valid-all-of.yaml b/src/test/resources/checks/v31/resources/OAR034/valid-all-of.yaml
new file mode 100644
index 00000000..2d09e193
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/valid-all-of.yaml
@@ -0,0 +1,84 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ first:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ previous:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ next:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ last:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/valid.json b/src/test/resources/checks/v31/resources/OAR034/valid.json
new file mode 100644
index 00000000..66e528b8
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/valid.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/valid.yaml b/src/test/resources/checks/v31/resources/OAR034/valid.yaml
new file mode 100644
index 00000000..886c61af
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/valid.yaml
@@ -0,0 +1,79 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.json b/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.json
new file mode 100644
index 00000000..2e467e85
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": { # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.yaml b/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.yaml
new file mode 100644
index 00000000..f4923170
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-links-without-properties.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links: # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.json b/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.json
new file mode 100644
index 00000000..eb99e6ab
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "string" # Noncompliant {{OAR034: 'start' must be of type integer}}
+ },
+ "limit": {
+ "type": "string" # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ },
+ "total": {
+ "type": "string" # Noncompliant {{OAR034: 'total' must be of type integer}}
+ },
+ "numPages": {
+ "type": "string" # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ },
+ "links": {
+ "type": "string", # Noncompliant {{OAR034: 'links' must be of type object}}
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.yaml b/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.yaml
new file mode 100644
index 00000000..b08d248f
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-with-properties-wrong-types.yaml
@@ -0,0 +1,63 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: string # Noncompliant {{OAR034: 'start' must be of type integer}}
+ limit:
+ type: string # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ total:
+ type: string # Noncompliant {{OAR034: 'total' must be of type integer}}
+ numPages:
+ type: string # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ links:
+ type: string # Noncompliant {{OAR034: 'links' must be of type object}}
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.json b/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.json
new file mode 100644
index 00000000..457133c7
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": { # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.yaml b/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.yaml
new file mode 100644
index 00000000..1429c9bc
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-without-properties.yaml
@@ -0,0 +1,51 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging: # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.json b/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.json
new file mode 100644
index 00000000..ab74c779
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.json
@@ -0,0 +1,73 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "string", # Noncompliant {{OAR034: 'paging' must be of type object}}
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.yaml b/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.yaml
new file mode 100644
index 00000000..7694cb9a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/with-paging-wrong-type.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: string # Noncompliant {{OAR034: 'paging' must be of type object}}
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.json b/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.json
new file mode 100644
index 00000000..82c0353e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self" ] # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.yaml b/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.yaml
new file mode 100644
index 00000000..cfcd88ef
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-links-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required: # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ - self
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.json b/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.json
new file mode 100644
index 00000000..d666c87c
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start" ] # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.yaml b/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.yaml
new file mode 100644
index 00000000..d5dd3512
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-pagination-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required: # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ - start
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-paging.json b/src/test/resources/checks/v31/resources/OAR034/without-paging.json
new file mode 100644
index 00000000..1da7c549
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-paging.json
@@ -0,0 +1,61 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR034: 'paging' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR034/without-paging.yaml b/src/test/resources/checks/v31/resources/OAR034/without-paging.yaml
new file mode 100644
index 00000000..d2a7a218
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR034/without-paging.yaml
@@ -0,0 +1,37 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR034: 'paging' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.json b/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.json
new file mode 100644
index 00000000..67723422
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.json
@@ -0,0 +1,48 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ },
+ "name" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.yaml b/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.yaml
new file mode 100644
index 00000000..fb5498dd
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-multiple-properties.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-one-property.json b/src/test/resources/checks/v31/resources/OAR038/valid-one-property.json
new file mode 100644
index 00000000..c4ded0b4
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-one-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-one-property.yaml b/src/test/resources/checks/v31/resources/OAR038/valid-one-property.yaml
new file mode 100644
index 00000000..50656cb5
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-one-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-with-error.json b/src/test/resources/checks/v31/resources/OAR038/valid-with-error.json
new file mode 100644
index 00000000..9324da59
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-with-error.json
@@ -0,0 +1 @@
+{"openapi":"3.1.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}
diff --git a/src/test/resources/checks/v31/resources/OAR038/valid-with-error.yaml b/src/test/resources/checks/v31/resources/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..a08e7401
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.json b/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..54c365d1
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.json
@@ -0,0 +1,2 @@
+{"openapi":"3.1.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type":"object","properties":{"id":{"type":"string"}}}}}}}}}
diff --git a/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..24c70642
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.json b/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.json
new file mode 100644
index 00000000..3f45a592
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type" : "object",
+ "properties" : { }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.yaml b/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.yaml
new file mode 100644
index 00000000..5cdefc1a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/with-properties-empty.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+ properties: {}
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-data.json b/src/test/resources/checks/v31/resources/OAR038/without-data.json
new file mode 100644
index 00000000..de142681
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-data.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-data.yaml b/src/test/resources/checks/v31/resources/OAR038/without-data.yaml
new file mode 100644
index 00000000..ced39065
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-data.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-properties.json b/src/test/resources/checks/v31/resources/OAR038/without-properties.json
new file mode 100644
index 00000000..f9f423c5
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-properties.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "post": {
+ "responses": {
+ "201": {
+ "$ref": "#/components/responses/createResponse"
+ },
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/post_response"
+ }
+ ]
+ },
+ "post_response": {
+ "type": "object",
+ "properties": {
+ "data": { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type": "object"
+ }
+ }
+ }
+ },
+ "responses": {
+ "createResponse": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-properties.yaml b/src/test/resources/checks/v31/resources/OAR038/without-properties.yaml
new file mode 100644
index 00000000..50fb5b62
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-properties.yaml
@@ -0,0 +1,33 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ $ref: '#/components/responses/createResponse'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/post_response'
+
+ post_response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+
+ responses:
+ createResponse:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-schema.json b/src/test/resources/checks/v31/resources/OAR038/without-schema.json
new file mode 100644
index 00000000..4ac5063e
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-schema.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR038: Response schema is required}}
+ "description" : "Ok"
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR038/without-schema.yaml b/src/test/resources/checks/v31/resources/OAR038/without-schema.yaml
new file mode 100644
index 00000000..9eecdf8a
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR038/without-schema.yaml
@@ -0,0 +1,12 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR038: Response schema is required}}
+ description: Ok
+ 204:
+ description: No content
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR039/missing-codes.json b/src/test/resources/checks/v31/resources/OAR039/missing-codes.json
new file mode 100644
index 00000000..18cf09e2
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR039/missing-codes.json
@@ -0,0 +1,109 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "put": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "patch": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "delete": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR039/missing-codes.yaml b/src/test/resources/checks/v31/resources/OAR039/missing-codes.yaml
new file mode 100644
index 00000000..da2618e7
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR039/missing-codes.yaml
@@ -0,0 +1,68 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ put:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ patch:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ delete:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR039/valid.json b/src/test/resources/checks/v31/resources/OAR039/valid.json
new file mode 100644
index 00000000..aa5bfe3b
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR039/valid.json
@@ -0,0 +1,283 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Partial collection"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/resources/OAR039/valid.yaml b/src/test/resources/checks/v31/resources/OAR039/valid.yaml
new file mode 100644
index 00000000..5f7621b2
--- /dev/null
+++ b/src/test/resources/checks/v31/resources/OAR039/valid.yaml
@@ -0,0 +1,184 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Partial collection
+ 400:
+ description: Bad request
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ put:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ patch:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ delete:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner:
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.json b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.json
new file mode 100644
index 00000000..d94e76f8
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.json
@@ -0,0 +1,134 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response_result"
+ },
+ {
+ "$ref": "#/components/schemas/standard_response_metadata"
+ }
+ ]
+ },
+ "standard_response_result": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "standard_response_metadata": {
+ "type": "object",
+ "properties": {
+ "metadata": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.yaml b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.yaml
new file mode 100644
index 00000000..c852082b
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of-md.yaml
@@ -0,0 +1,78 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ standard_response_result:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
+ standard_response_metadata:
+ type: object
+ properties:
+ metadata:
+ type: string
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.json b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.json
new file mode 100644
index 00000000..9f519b0e
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response_result"
+ }, {
+ "$ref" : "#/components/schemas/standard_response_metadata"
+ } ],
+ "required" : [ "status" ]
+ },
+ "standard_response_result" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ },
+ "standard_response_metadata" : {
+ "properties" : {
+ "metadata" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.yaml b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.yaml
new file mode 100644
index 00000000..96ac8d09
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-all-of.yaml
@@ -0,0 +1,76 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ required:
+ - status
+ standard_response_result:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
+ standard_response_metadata:
+ properties:
+ metadata:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-md.json b/src/test/resources/checks/v31/schemas/OAR029/valid-md.json
new file mode 100644
index 00000000..088962d7
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-md.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-md.yaml b/src/test/resources/checks/v31/schemas/OAR029/valid-md.yaml
new file mode 100644
index 00000000..613f2f7a
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-md.yaml
@@ -0,0 +1,69 @@
+openapi: "3.1.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-r.json b/src/test/resources/checks/v31/schemas/OAR029/valid-r.json
new file mode 100644
index 00000000..f67f6299
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-r.json
@@ -0,0 +1,96 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponseData"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "$ref": "#/components/responses/errorResponse"
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponseData": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponseData": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "errorResponse": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponseData"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid-r.yaml b/src/test/resources/checks/v31/schemas/OAR029/valid-r.yaml
new file mode 100644
index 00000000..ecb01a86
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid-r.yaml
@@ -0,0 +1,59 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponseData'
+ 204:
+ description: No content
+ 400:
+ $ref: '#/components/responses/errorResponse'
+ default:
+ description: Unknown
+components:
+ schemas:
+ successResponseData:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponseData:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
+ responses:
+ errorResponse:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponseData'
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid.json b/src/test/resources/checks/v31/schemas/OAR029/valid.json
new file mode 100644
index 00000000..b1bc4266
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid.json
@@ -0,0 +1,105 @@
+{
+ "openapi": "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "status",
+ "data"
+ ]
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR029/valid.yaml b/src/test/resources/checks/v31/schemas/OAR029/valid.yaml
index b4c7d96e..9a7afd5f 100644
--- a/src/test/resources/checks/v31/schemas/OAR029/valid.yaml
+++ b/src/test/resources/checks/v31/schemas/OAR029/valid.yaml
@@ -1,19 +1,135 @@
openapi: "3.1.0"
info:
- version: 1.0.0
- title: Test
+ version: 1.0.3
+ title: Swagger-Petstore_ab4bbf6031ef_V
+ license:
+ name: MIT
+servers:
+ - url: http://petstore.swagger.io/v1
paths:
- /test:
+ /pets:
get:
+ summary: List all pets
+ operationId: listPets
+ tags:
+ - pets
+ parameters:
+ - name: limit
+ in: query
+ description: How many items to return at one time (max 100).
+ required: false
+ schema:
+ type: integer
+ maximum: 100
+ format: int32
responses:
- "200":
- description: ok
+ '200':
+ description: A paged array of pets
+ headers:
+ x-next:
+ description: A link to the next page of responses
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >-
+ https://gitlab.com/api/v4/projects/55448121/repository/files/pet%2Eyaml/raw?private_token=glpat-Q7s_ciqer49cJB--sMFB#/Pets
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+ post:
+ summary: Create a pet
+ operationId: createPets
+ tags:
+ - pets
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ required: true
+ responses:
+ '201':
+ description: Null response
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+ /pets/{petId}:
+ get:
+ summary: Info for a specific pet
+ operationId: showPetById
+ tags:
+ - pets
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ description: The id of the pet to retrieve
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Expected response to a valid request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ default:
+ description: unexpected error
content:
application/json:
schema:
- type: object
- properties:
- status:
- type: object
- payload:
- type: object
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+components:
+ schemas:
+ Pet:
+ type: object
+ required:
+ - id
+ - name
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ tag:
+ type: string
+ Pets:
+ type: array
+ maxItems: 100
+ items:
+ $ref: '#/components/schemas/Pet'
+ Error:
+ type: object
+ required:
+ - code
+ - message
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
diff --git a/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.json b/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.json
new file mode 100644
index 00000000..614ad88f
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.json
@@ -0,0 +1,126 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "first": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "previous": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "next": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "last": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.yaml b/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.yaml
new file mode 100644
index 00000000..2d09e193
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/valid-all-of.yaml
@@ -0,0 +1,84 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ first:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ previous:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ next:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ last:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/valid.json b/src/test/resources/checks/v31/schemas/OAR034/valid.json
new file mode 100644
index 00000000..48f81817
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/valid.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/valid.yaml b/src/test/resources/checks/v31/schemas/OAR034/valid.yaml
new file mode 100644
index 00000000..886c61af
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/valid.yaml
@@ -0,0 +1,79 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.json b/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.json
new file mode 100644
index 00000000..4174dfca
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.json
@@ -0,0 +1,96 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": { # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.yaml b/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.yaml
new file mode 100644
index 00000000..f4923170
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-links-without-properties.yaml
@@ -0,0 +1,66 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links: # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.json b/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.json
new file mode 100644
index 00000000..c65020a4
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.json
@@ -0,0 +1,91 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "string" # Noncompliant {{OAR034: 'start' must be of type integer}}
+ },
+ "limit": {
+ "type": "string" # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ },
+ "total": {
+ "type": "string" # Noncompliant {{OAR034: 'total' must be of type integer}}
+ },
+ "numPages": {
+ "type": "string" # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ },
+ "links": {
+ "type": "string", # Noncompliant {{OAR034: 'links' must be of type object}}
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.yaml b/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.yaml
new file mode 100644
index 00000000..b08d248f
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-with-properties-wrong-types.yaml
@@ -0,0 +1,63 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: string # Noncompliant {{OAR034: 'start' must be of type integer}}
+ limit:
+ type: string # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ total:
+ type: string # Noncompliant {{OAR034: 'total' must be of type integer}}
+ numPages:
+ type: string # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ links:
+ type: string # Noncompliant {{OAR034: 'links' must be of type object}}
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.json b/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.json
new file mode 100644
index 00000000..1352dcc8
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.json
@@ -0,0 +1,78 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": { # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.yaml b/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.yaml
new file mode 100644
index 00000000..1429c9bc
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-without-properties.yaml
@@ -0,0 +1,51 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging: # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.json b/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.json
new file mode 100644
index 00000000..9a70a9ed
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.json
@@ -0,0 +1,73 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "string", # Noncompliant {{OAR034: 'paging' must be of type object}}
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.yaml b/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.yaml
new file mode 100644
index 00000000..7694cb9a
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/with-paging-wrong-type.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: string # Noncompliant {{OAR034: 'paging' must be of type object}}
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.json b/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.json
new file mode 100644
index 00000000..22dc4940
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self" ] # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.yaml b/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.yaml
new file mode 100644
index 00000000..cfcd88ef
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-links-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required: # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ - self
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.json b/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.json
new file mode 100644
index 00000000..b78c713c
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start" ] # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.yaml b/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.yaml
new file mode 100644
index 00000000..d5dd3512
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-pagination-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required: # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ - start
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-paging.json b/src/test/resources/checks/v31/schemas/OAR034/without-paging.json
new file mode 100644
index 00000000..d7c3098f
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-paging.json
@@ -0,0 +1,61 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR034: 'paging' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR034/without-paging.yaml b/src/test/resources/checks/v31/schemas/OAR034/without-paging.yaml
new file mode 100644
index 00000000..d2a7a218
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR034/without-paging.yaml
@@ -0,0 +1,37 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR034: 'paging' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.json b/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.json
new file mode 100644
index 00000000..82a2cdf3
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "security": [],
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.yaml b/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.yaml
new file mode 100644
index 00000000..4dc29cee
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/empty-global-security.yaml
@@ -0,0 +1,12 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+security: []
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/schemas/OAR080/empty-security.json b/src/test/resources/checks/v31/schemas/OAR080/empty-security.json
new file mode 100644
index 00000000..526e63cd
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/empty-security.json
@@ -0,0 +1,31 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/schemas/OAR080/empty-security.yaml b/src/test/resources/checks/v31/schemas/OAR080/empty-security.yaml
new file mode 100644
index 00000000..eb3af992
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/empty-security.yaml
@@ -0,0 +1,19 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security: []
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/schemas/OAR080/global-security.json b/src/test/resources/checks/v31/schemas/OAR080/global-security.json
new file mode 100644
index 00000000..690c60a8
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/global-security.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "security": [
+ { "apiKey": [] },
+ { "oauth2": [] }
+ ],
+ "components": {
+ "securitySchemes": {
+ "oauth2": {
+ "type": "oauth2",
+ "flows": {
+ "implicit": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "scopes": {
+ "read": "Read access"
+ }
+ }
+ }
+ },
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "summary": "Create a new product",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/schemas/OAR080/global-security.yaml b/src/test/resources/checks/v31/schemas/OAR080/global-security.yaml
new file mode 100644
index 00000000..d720f919
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/global-security.yaml
@@ -0,0 +1,51 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+security:
+ - apiKey: []
+ - oauth2: []
+components:
+ securitySchemes:
+ oauth2:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: https://example.com/oauth/authorize
+ scopes:
+ read: Read access
+ apiKey:
+ type: apiKey
+ name: X-API-Key
+ in: header
+paths:
+ /users:
+ get:
+ summary: Get all users
+ responses:
+ '200':
+ description: OK
+ /products:
+ post:
+ summary: Create a new product
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put:
+ summary: Update an order
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete:
+ summary: Delete an invoice
+ responses:
+ '200':
+ description: OK
+ /items:
+ patch:
+ summary: Patch an item
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/schemas/OAR080/with-security.json b/src/test/resources/checks/v31/schemas/OAR080/with-security.json
new file mode 100644
index 00000000..fab34158
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/with-security.json
@@ -0,0 +1,71 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "security": [
+ {
+ "apiKey": [],
+ "oauth2": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "summary": "Create a new product",
+ "security": [
+ {
+ "oauth2": [],
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Update an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Delete an invoice",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR080/with-security.yaml b/src/test/resources/checks/v31/schemas/OAR080/with-security.yaml
new file mode 100644
index 00000000..2221d48e
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/with-security.yaml
@@ -0,0 +1,39 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get:
+ summary: Get all users
+ security:
+ - apiKey: []
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post:
+ summary: Create a new product
+ security:
+ - apiKey: []
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Update an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Delete an invoice
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR080/without-security.json b/src/test/resources/checks/v31/schemas/OAR080/without-security.json
new file mode 100644
index 00000000..416403b8
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/without-security.json
@@ -0,0 +1,69 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [
+ {
+ "oauth2": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Update an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Delete an invoice",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR080/without-security.yaml b/src/test/resources/checks/v31/schemas/OAR080/without-security.yaml
new file mode 100644
index 00000000..34e2dbe5
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/without-security.yaml
@@ -0,0 +1,37 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security:
+ - apiKey: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security:
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Update an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Delete an invoice
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.json b/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.json
new file mode 100644
index 00000000..83789132
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "patch": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Patch an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.yaml b/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.yaml
new file mode 100644
index 00000000..ae5efffc
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR080/wrong-scheme.yaml
@@ -0,0 +1,35 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security:
+ - apiKey: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ patch: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Patch an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /items:
+ head:
+ summary: Head – non-security verb, ignored
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/schemas/OAR108/invalid.json b/src/test/resources/checks/v31/schemas/OAR108/invalid.json
new file mode 100644
index 00000000..cebe145c
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR108/invalid.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Ejemplo de API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/item": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "nombre": {
+ "type": "string"
+ }
+ },
+ "required": ["id", "nombre"]
+ },
+ "example": { # Noncompliant {{OAR108: Schema does not match the provided example}}
+ "id": "hola",
+ "nombre": "Ejemplo"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/src/test/resources/checks/v31/schemas/OAR108/invalid.yaml b/src/test/resources/checks/v31/schemas/OAR108/invalid.yaml
new file mode 100644
index 00000000..d0e2a6a4
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR108/invalid.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.1.0"
+ info:
+ title: Ejemplo de API
+ version: 1.0.0
+ paths:
+ /item:
+ get:
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ nombre:
+ type: string
+ required:
+ - id
+ - nombre
+ example: # Noncompliant {{OAR108: Schema does not match the provided example}}
+ id: hola123
+ nombre: Ejemplo
diff --git a/src/test/resources/checks/v31/schemas/OAR108/valid.json b/src/test/resources/checks/v31/schemas/OAR108/valid.json
new file mode 100644
index 00000000..12cfcc38
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR108/valid.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Ejemplo de API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/item": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number"
+ },
+ "nombre": {
+ "type": "string"
+ }
+ },
+ "required": ["id", "nombre"]
+ },
+ "example": {
+ "id": 12.3,
+ "nombre": "Ejemplo"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/src/test/resources/checks/v31/schemas/OAR108/valid.yaml b/src/test/resources/checks/v31/schemas/OAR108/valid.yaml
new file mode 100644
index 00000000..3575773c
--- /dev/null
+++ b/src/test/resources/checks/v31/schemas/OAR108/valid.yaml
@@ -0,0 +1,47 @@
+openapi: "3.1.0"
+info:
+ title: Ejemplo de API Ampliada
+ version: 1.0.0
+paths:
+ /item:
+ get:
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: number
+ nombre:
+ type: string
+ activo:
+ type: boolean
+ configuracion:
+ type: object
+ properties:
+ tema:
+ type: string
+ notificaciones:
+ type: boolean
+ tags:
+ type: array
+ items:
+ type: string
+ proyectoNull:
+ type: string
+ nullable: true
+ required:
+ - id
+ - nombre
+ example:
+ id: 123.0
+ nombre: Ejemplo
+ activo: false
+ configuracion:
+ tema: Oscuro
+ notificaciones: true
+ tags: ["api", "openapi"]
+ proyectoNull: null
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR001/with-servers.json b/src/test/resources/checks/v31/security/OAR001/with-servers.json
new file mode 100644
index 00000000..8c58ff7d
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR001/with-servers.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/v1" # Noncompliant {{OAR001: Protocol https in server url is mandatory}}
+ }
+ ],
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR001/with-servers.yaml b/src/test/resources/checks/v31/security/OAR001/with-servers.yaml
new file mode 100644
index 00000000..cad7330c
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR001/with-servers.yaml
@@ -0,0 +1,8 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: http://petstore.swagger.io/v1 # Noncompliant {{OAR001: Protocol https in server url is mandatory}}
+paths:
+ /pets: {}
diff --git a/src/test/resources/checks/v31/security/OAR001/without-servers.json b/src/test/resources/checks/v31/security/OAR001/without-servers.json
new file mode 100644
index 00000000..340f656c
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR001/without-servers.json
@@ -0,0 +1,10 @@
+{ # Noncompliant {{OAR001: Define 'servers' is mandatory}}
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR001/without-servers.yaml b/src/test/resources/checks/v31/security/OAR001/without-servers.yaml
new file mode 100644
index 00000000..c343548e
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR001/without-servers.yaml
@@ -0,0 +1,7 @@
+# Noncompliant {{OAR001: Define 'servers' is mandatory}}
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
diff --git a/src/test/resources/checks/v31/security/OAR033/valid.json b/src/test/resources/checks/v31/security/OAR033/valid.json
new file mode 100644
index 00000000..0084fa1b
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/valid.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "header",
+ "name": "traceId",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "header",
+ "name": "dateTime",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "query",
+ "name": "Authorization",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR033/valid.yaml b/src/test/resources/checks/v31/security/OAR033/valid.yaml
new file mode 100644
index 00000000..22323221
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/valid.yaml
@@ -0,0 +1,31 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /petts:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ - in: header
+ name: traceId
+ schema:
+ type: string
+ required: true
+ - in: header
+ name: dateTime
+ schema:
+ type: string
+ required: true
+ - in: query
+ name: Authorization
+ schema:
+ type: string
+ required: true
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.json b/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.json
new file mode 100644
index 00000000..a181f556
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "x-api-key": {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ "accept": {
+ "in": "header",
+ "name": "Accept", # Noncompliant {{OAR033: Header not allowed}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/x-api-key"
+ },
+ {
+ "$ref": "#/components/parameters/accept"
+ },
+ {
+ "in": "header",
+ "name": "Authorization", # Noncompliant {{OAR033: Header not allowed}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.yaml b/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.yaml
new file mode 100644
index 00000000..8d3bdadb
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/with-forbidden-params.yaml
@@ -0,0 +1,32 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ x-api-key:
+ in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ accept:
+ in: header
+ name: Accept # Noncompliant {{OAR033: Header not allowed}}
+ schema:
+ type: string
+ required: true
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/x-api-key'
+ - $ref: '#/components/parameters/accept'
+ - in: header
+ name: Authorization # Noncompliant {{OAR033: Header not allowed}}
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR033/without-required-params.json b/src/test/resources/checks/v31/security/OAR033/without-required-params.json
new file mode 100644
index 00000000..edfb56b3
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/without-required-params.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "x-api-key": {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ "traceId": {
+ "in": "header",
+ "name": "traceId",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/traceId"
+ }
+ ],
+ "get": { # Noncompliant {{OAR033: Headers [x-api-key] are required}}
+ "parameters": [
+ {
+ "in": "header",
+ "name": "dateTime",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR033/without-required-params.yaml b/src/test/resources/checks/v31/security/OAR033/without-required-params.yaml
new file mode 100644
index 00000000..0adc73ea
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR033/without-required-params.yaml
@@ -0,0 +1,32 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ x-api-key:
+ in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ traceId:
+ in: header
+ name: traceId
+ schema:
+ type: string
+ required: true
+paths:
+ /pets:
+ parameters:
+ - $ref: '#/components/parameters/traceId'
+ get: # Noncompliant {{OAR033: Headers [x-api-key] are required}}
+ parameters:
+ - in: header
+ name: dateTime
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR035/valid.json b/src/test/resources/checks/v31/security/OAR035/valid.json
new file mode 100644
index 00000000..09460094
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR035/valid.json
@@ -0,0 +1,117 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": [
+
+ ]
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "403": {
+ "description": "Forbidden"
+ },
+ "429": {
+ "description": "Forbidden"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "429": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR035/valid.yaml b/src/test/resources/checks/v31/security/OAR035/valid.yaml
new file mode 100644
index 00000000..ff056dea
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR035/valid.yaml
@@ -0,0 +1,70 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 403:
+ description: Forbidden
+ 429:
+ description: Forbidden
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 429:
+ description: Unauthorized
+ /without:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.json b/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.json
new file mode 100644
index 00000000..6b76ce5b
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.json
@@ -0,0 +1,100 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": { # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.yaml b/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.yaml
new file mode 100644
index 00000000..dd06149a
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR035/without-authorization-responses.yaml
@@ -0,0 +1,62 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /without:
+ get:
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR036/valid.json b/src/test/resources/checks/v31/security/OAR036/valid.json
new file mode 100644
index 00000000..e1cc4f56
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR036/valid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [ {
+ "in": "header",
+ "name": "X-Authorization",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR036/valid.yaml b/src/test/resources/checks/v31/security/OAR036/valid.yaml
new file mode 100644
index 00000000..b746cce4
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR036/valid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: header
+ name: X-Authorization
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR036/with-cookie.json b/src/test/resources/checks/v31/security/OAR036/with-cookie.json
new file mode 100644
index 00000000..a1bd49b1
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR036/with-cookie.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [ {
+ "in": "header",
+ "name": "Cookie", # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "get": {
+ "parameters": [ {
+ "in": "header",
+ "name": "Cookie", # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "headers": {
+ "Set-Cookie": { # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "description": "session"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR036/with-cookie.yaml b/src/test/resources/checks/v31/security/OAR036/with-cookie.yaml
new file mode 100644
index 00000000..02d7edd0
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR036/with-cookie.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: header
+ name: Cookie # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: header
+ name: Cookie # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
+ headers:
+ Set-Cookie: # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ description: session
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR045/defined-response.json b/src/test/resources/checks/v31/security/OAR045/defined-response.json
new file mode 100644
index 00000000..b73d9c78
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR045/defined-response.yaml b/src/test/resources/checks/v31/security/OAR045/defined-response.yaml
new file mode 100644
index 00000000..6540560a
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v31/security/OAR049/no-content-in-204.json b/src/test/resources/checks/v31/security/OAR049/no-content-in-204.json
new file mode 100644
index 00000000..dcfe19fe
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR049/no-content-in-204.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/other-pets/{petId}" : {
+ "delete" : {
+ "responses" : {
+ "204" : { # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ "description" : "delete pet",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "type" : "object"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR049/no-content-in-204.yaml b/src/test/resources/checks/v31/security/OAR049/no-content-in-204.yaml
new file mode 100644
index 00000000..2636d1eb
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR049/no-content-in-204.yaml
@@ -0,0 +1,14 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /other-pets/{petId}:
+ delete:
+ responses:
+ '204': # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ description: delete pet
+ content:
+ 'application/json':
+ schema:
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR053/excluded-code.json b/src/test/resources/checks/v31/security/OAR053/excluded-code.json
new file mode 100644
index 00000000..1ccf567f
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/excluded-code.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No Content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR053/excluded-code.yaml b/src/test/resources/checks/v31/security/OAR053/excluded-code.yaml
new file mode 100644
index 00000000..9f7e9866
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/excluded-code.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ delete:
+ responses:
+ '204':
+ description: No Content
diff --git a/src/test/resources/checks/v31/security/OAR053/excluded-path.json b/src/test/resources/checks/v31/security/OAR053/excluded-path.json
new file mode 100644
index 00000000..ad1c0125
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/excluded-path.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR053/excluded-path.yaml b/src/test/resources/checks/v31/security/OAR053/excluded-path.yaml
new file mode 100644
index 00000000..165c23c1
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/excluded-path.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /status:
+ get:
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/security/OAR053/forbidden-header.json b/src/test/resources/checks/v31/security/OAR053/forbidden-header.json
new file mode 100644
index 00000000..812de108
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/forbidden-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-forbidden-custom-header": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR053/forbidden-header.yaml b/src/test/resources/checks/v31/security/OAR053/forbidden-header.yaml
new file mode 100644
index 00000000..d8a00eb3
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/forbidden-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ x-forbidden-custom-header:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v31/security/OAR053/missing-header.json b/src/test/resources/checks/v31/security/OAR053/missing-header.json
new file mode 100644
index 00000000..b3f8a993
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/missing-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "idCorrelacion": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR053/missing-header.yaml b/src/test/resources/checks/v31/security/OAR053/missing-header.yaml
new file mode 100644
index 00000000..b56a02e6
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/missing-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ idCorrelacion:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v31/security/OAR053/valid.json b/src/test/resources/checks/v31/security/OAR053/valid.json
new file mode 100644
index 00000000..e82e1159
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/valid.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "headers": {
+ "x-trace-id": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ },
+ "400": {
+ "description": "Bad Request",
+ "headers": {
+ "x-trace-id": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR053/valid.yaml b/src/test/resources/checks/v31/security/OAR053/valid.yaml
new file mode 100644
index 00000000..d37fcf08
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR053/valid.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ responses:
+ PetsResponse:
+ description: OK
+ headers:
+ x-trace-id:
+ schema:
+ type: string
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/PetsResponse'
+ '400':
+ description: Bad Request
+ headers:
+ x-trace-id:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR054/valid.json b/src/test/resources/checks/v31/security/OAR054/valid.json
new file mode 100644
index 00000000..dfcdbddf
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR054/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "https://api-dev.apiaddicts.org/api-vehicular/v1/"
+ },
+ {
+ "url": "https://api-test.apiaddicts.org/api-vehicular/v1/"
+ },
+ {
+ "url": "https://api.apiaddicts.org/api-vehicular/v1/"
+ }
+ ],
+ "paths": { }
+}
diff --git a/src/test/resources/checks/v31/security/OAR054/valid.yaml b/src/test/resources/checks/v31/security/OAR054/valid.yaml
new file mode 100644
index 00000000..95609164
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR054/valid.yaml
@@ -0,0 +1,9 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://api-dev.apiaddicts.org/api-vehicular/v1/
+ - url: https://api-test.apiaddicts.org/api-vehicular/v1/
+ - url: https://api.apiaddicts.org/api-vehicular/v1/
+paths: {}
diff --git a/src/test/resources/checks/v31/security/OAR072/no-stack-trace.json b/src/test/resources/checks/v31/security/OAR072/no-stack-trace.json
new file mode 100644
index 00000000..112ec2a2
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR072/no-stack-trace.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Compliant API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string",
+ "maxLength": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "maxLength": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR072/no-stack-trace.yaml b/src/test/resources/checks/v31/security/OAR072/no-stack-trace.yaml
new file mode 100644
index 00000000..6ff881d8
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR072/no-stack-trace.yaml
@@ -0,0 +1,36 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ status:
+ type: string
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
+ details:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR072/with-stack-trace.json b/src/test/resources/checks/v31/security/OAR072/with-stack-trace.json
new file mode 100644
index 00000000..ea888ddf
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR072/with-stack-trace.json
@@ -0,0 +1,62 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Successful operation",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "string"
+ },
+ "stackTrace": { # Noncompliant {{OAR072: Non OK responses shouldnt have stackTraces}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR072/with-stack-trace.yaml b/src/test/resources/checks/v31/security/OAR072/with-stack-trace.yaml
new file mode 100644
index 00000000..fd9a9085
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR072/with-stack-trace.yaml
@@ -0,0 +1,40 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '201':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ status:
+ type: string
+ stackTrace:
+ type: string
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
+ details:
+ type: string
+ stackTrace: # Noncompliant {{OAR072: Non OK responses shouldnt have stackTraces}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR074/no-restrictions.json b/src/test/resources/checks/v31/security/OAR074/no-restrictions.json
new file mode 100644
index 00000000..51348504
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR074/no-restrictions.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "integer" # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "number" # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR074/no-restrictions.yaml b/src/test/resources/checks/v31/security/OAR074/no-restrictions.yaml
new file mode 100644
index 00000000..09b65488
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR074/no-restrictions.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: integer # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ - name: param2
+ in: query
+ schema:
+ type: number # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ responses:
+ 200:
+ description: A list of items
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR074/with-restrictions.json b/src/test/resources/checks/v31/security/OAR074/with-restrictions.json
new file mode 100644
index 00000000..88390131
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR074/with-restrictions.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 100,
+ "format": "double"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR074/with-restrictions.yaml b/src/test/resources/checks/v31/security/OAR074/with-restrictions.yaml
new file mode 100644
index 00000000..cea2b841
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR074/with-restrictions.yaml
@@ -0,0 +1,26 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ format: double
+ - name: param2
+ in: query
+ schema:
+ type: number
+ minimum: 1
+ maximum: 100
+ format: double
+ responses:
+ 200:
+ description: A list of items
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR075/no-restrictions.json b/src/test/resources/checks/v31/security/OAR075/no-restrictions.json
new file mode 100644
index 00000000..db317f9c
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR075/no-restrictions.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API sin restricciones",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string" # Noncompliant {{OAR075: String parameters should have minLength, maxLength, pattern (regular expression), or enum restriction that are defined in the properties}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Un usuario"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR075/no-restrictions.yaml b/src/test/resources/checks/v31/security/OAR075/no-restrictions.yaml
new file mode 100644
index 00000000..e995a772
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR075/no-restrictions.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ title: API sin restricciones
+ version: 1.0.0
+paths:
+ /users/{id}:
+ get:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string # Noncompliant {{OAR075: String parameters should have minLength, maxLength, pattern (regular expression), or enum restriction that are defined in the properties}}
+ responses:
+ '200':
+ description: Un usuario
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR075/with-restrictions.json b/src/test/resources/checks/v31/security/OAR075/with-restrictions.json
new file mode 100644
index 00000000..0865c2c9
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR075/with-restrictions.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "API con restricciones",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "minLength": 5,
+ "maxLength": 120,
+ "format": "date",
+ "enum": ["admin", "user", "guest"]
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Un usuario"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR075/with-restrictions.yaml b/src/test/resources/checks/v31/security/OAR075/with-restrictions.yaml
new file mode 100644
index 00000000..bcea6995
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR075/with-restrictions.yaml
@@ -0,0 +1,20 @@
+openapi: "3.1.0"
+info:
+ title: API con restricciones
+ version: 1.0.0
+paths:
+ /users/{id}:
+ get:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 120
+ format: date
+ enum: ['admin', 'user', 'guest']
+ responses:
+ '200':
+ description: Un usuario
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR076/nested.json b/src/test/resources/checks/v31/security/OAR076/nested.json
new file mode 100644
index 00000000..d42127d5
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/nested.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR076/nested.yaml b/src/test/resources/checks/v31/security/OAR076/nested.yaml
new file mode 100644
index 00000000..095dde98
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/nested.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int64
+
diff --git a/src/test/resources/checks/v31/security/OAR076/plain.json b/src/test/resources/checks/v31/security/OAR076/plain.json
new file mode 100644
index 00000000..bca59f52
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer" # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ },
+ "product_id": {
+ "type": "integer", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int32"
+ },
+ "price": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR076/plain.yaml b/src/test/resources/checks/v31/security/OAR076/plain.yaml
new file mode 100644
index 00000000..068162fb
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/plain.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ product_id:
+ type: integer # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int128
+ line:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int32
+ price:
+ type: number
+ format: double
+
diff --git a/src/test/resources/checks/v31/security/OAR076/with-$ref.json b/src/test/resources/checks/v31/security/OAR076/with-$ref.json
new file mode 100644
index 00000000..fe3074fb
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR076/with-$ref.yaml b/src/test/resources/checks/v31/security/OAR076/with-$ref.yaml
new file mode 100644
index 00000000..07c14a88
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR076/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int64
diff --git a/src/test/resources/checks/v31/security/OAR078/no-security.json b/src/test/resources/checks/v31/security/OAR078/no-security.json
new file mode 100644
index 00000000..6df09dc1
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR078/no-security.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "components": {
+ "securitySchemes": {
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR078/no-security.yaml b/src/test/resources/checks/v31/security/OAR078/no-security.yaml
new file mode 100644
index 00000000..f97db470
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR078/no-security.yaml
@@ -0,0 +1,33 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Sample API
+components:
+ securitySchemes:
+ apiKey:
+ type: apiKey
+ name: X-API-Key
+ in: header
+paths:
+ /users:
+ get: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+
+ /orders:
+ put: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+
+ /invoices:
+ delete: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v31/security/OAR078/with-security.json b/src/test/resources/checks/v31/security/OAR078/with-security.json
new file mode 100644
index 00000000..1cb7ce1e
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR078/with-security.json
@@ -0,0 +1,74 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK esto a json"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR078/with-security.yaml b/src/test/resources/checks/v31/security/OAR078/with-security.yaml
new file mode 100644
index 00000000..83c4b9c4
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR078/with-security.yaml
@@ -0,0 +1,49 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com/v1
+
+# Definición de seguridad global
+security:
+ - apiKeyHeader: []
+
+paths:
+ /items:
+ get: # Verb 'get' sin definición de seguridad local
+ summary: Get all items
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Item'
+ post: # Verb 'post' sin definición de seguridad local
+ summary: Create an item
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Item'
+ responses:
+ '201':
+ description: Item created
+
+components:
+ schemas:
+ Item:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ securitySchemes:
+ apiKeyHeader:
+ type: apiKey
+ in: header
+ name: X-API-Key
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR079/bad-request404.json b/src/test/resources/checks/v31/security/OAR079/bad-request404.json
new file mode 100644
index 00000000..feffafed
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/bad-request404.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Bad Request"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR079/bad-request404.yaml b/src/test/resources/checks/v31/security/OAR079/bad-request404.yaml
new file mode 100644
index 00000000..a0d15464
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/bad-request404.yaml
@@ -0,0 +1,25 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 404:
+ description: Bad Request
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR079/no-bad-request404.json b/src/test/resources/checks/v31/security/OAR079/no-bad-request404.json
new file mode 100644
index 00000000..919bc0d2
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/no-bad-request404.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/example1": {
+ "get": {
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": { # Noncompliant {{OAR079: Paths parameters, should have not found (404) response}}
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR079/no-bad-request404.yaml b/src/test/resources/checks/v31/security/OAR079/no-bad-request404.yaml
new file mode 100644
index 00000000..b8dacb5d
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/no-bad-request404.yaml
@@ -0,0 +1,22 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
diff --git a/src/test/resources/checks/v31/security/OAR079/no-parameters.json b/src/test/resources/checks/v31/security/OAR079/no-parameters.json
new file mode 100644
index 00000000..ba173982
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/no-parameters.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR079/no-parameters.yaml b/src/test/resources/checks/v31/security/OAR079/no-parameters.yaml
new file mode 100644
index 00000000..8d492218
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v31/security/OAR079/query-param-only.json b/src/test/resources/checks/v31/security/OAR079/query-param-only.json
new file mode 100644
index 00000000..3fd4ba30
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/query-param-only.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR079/query-param-only.yaml b/src/test/resources/checks/v31/security/OAR079/query-param-only.yaml
new file mode 100644
index 00000000..1e21daa0
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR079/query-param-only.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v31/security/OAR081/.gitkeep b/src/test/resources/checks/v31/security/OAR081/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/src/test/resources/checks/v31/security/OAR081/not-valid-password.json b/src/test/resources/checks/v31/security/OAR081/not-valid-password.json
new file mode 100644
index 00000000..db02d02d
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/not-valid-password.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": { # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ "type": "string",
+ "format": "number"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR081/not-valid-password.yaml b/src/test/resources/checks/v31/security/OAR081/not-valid-password.yaml
new file mode 100644
index 00000000..e4d17b72
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/not-valid-password.yaml
@@ -0,0 +1,31 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR081/valid-password.json b/src/test/resources/checks/v31/security/OAR081/valid-password.json
new file mode 100644
index 00000000..57347217
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/valid-password.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR081/valid-password.yaml b/src/test/resources/checks/v31/security/OAR081/valid-password.yaml
new file mode 100644
index 00000000..a63ab900
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/valid-password.yaml
@@ -0,0 +1,31 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password:
+ type: string
+ format: password
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password:
+ type: string
+ format: password
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR081/valid-with-components.json b/src/test/resources/checks/v31/security/OAR081/valid-with-components.json
new file mode 100644
index 00000000..87505e35
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/valid-with-components.json
@@ -0,0 +1,50 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "User": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": { # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ "type": "string",
+ "format": "number"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR081/valid-with-components.yaml b/src/test/resources/checks/v31/security/OAR081/valid-with-components.yaml
new file mode 100644
index 00000000..716f4e5d
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR081/valid-with-components.yaml
@@ -0,0 +1,29 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+components:
+ schemas:
+ User:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR082/.gitkeep b/src/test/resources/checks/v31/security/OAR082/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/src/test/resources/checks/v31/security/OAR082/valid-format.json b/src/test/resources/checks/v31/security/OAR082/valid-format.json
new file mode 100644
index 00000000..23251d95
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR082/valid-format.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "product": {
+ "type": "string", # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "string" # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ },
+ "price": {
+ "type": "string",
+ "format": "byte"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR082/valid-format.yaml b/src/test/resources/checks/v31/security/OAR082/valid-format.yaml
new file mode 100644
index 00000000..ec26b569
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR082/valid-format.yaml
@@ -0,0 +1,23 @@
+openapi: "3.1.0"
+info:
+ version: "1.0.0"
+ title: "Swagger Petstore"
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ product:
+ type: string # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ format: int128
+ line:
+ type: string # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ price:
+ type: string
+ format: byte
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.json b/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.json
new file mode 100644
index 00000000..63ab440d
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [ # Noncompliant {{OAR083: The parameter email should not pass through this querystring}}
+ {
+ "name": "email",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "patata",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.yaml b/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.yaml
new file mode 100644
index 00000000..39c12f18
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/forbidden-query-params.yaml
@@ -0,0 +1,26 @@
+ openapi: "3.1.0"
+ info:
+ version: 1.0.0
+ title: My API
+ paths:
+ /examples:
+ post:
+ summary: Get a list of items
+ parameters: # Noncompliant {{OAR083: The parameter email should not pass through this querystring}}
+ - name: email
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR083/no-parameters.json b/src/test/resources/checks/v31/security/OAR083/no-parameters.json
new file mode 100644
index 00000000..35a232b1
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/no-parameters.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR083/no-parameters.yaml b/src/test/resources/checks/v31/security/OAR083/no-parameters.yaml
new file mode 100644
index 00000000..54deb746
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v31/security/OAR083/null-name-param.json b/src/test/resources/checks/v31/security/OAR083/null-name-param.json
new file mode 100644
index 00000000..1495a5b1
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/null-name-param.json
@@ -0,0 +1,30 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "summary": "Get an item",
+ "parameters": [
+ {
+ "name": null,
+ "in": "query",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": { "description": "An item" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR083/null-name-param.yaml b/src/test/resources/checks/v31/security/OAR083/null-name-param.yaml
new file mode 100644
index 00000000..54e5a255
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/null-name-param.yaml
@@ -0,0 +1,21 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples/{id}:
+ get:
+ summary: Get an item
+ parameters:
+ - name: ~
+ in: query
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ 200:
+ description: An item
diff --git a/src/test/resources/checks/v31/security/OAR083/options-operation.json b/src/test/resources/checks/v31/security/OAR083/options-operation.json
new file mode 100644
index 00000000..318fe28f
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/options-operation.json
@@ -0,0 +1,24 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "options": {
+ "summary": "Options for the resource",
+ "parameters": [
+ {
+ "name": "email",
+ "in": "query",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR083/options-operation.yaml b/src/test/resources/checks/v31/security/OAR083/options-operation.yaml
new file mode 100644
index 00000000..c842d6c8
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/options-operation.yaml
@@ -0,0 +1,16 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ options:
+ summary: Options for the resource
+ parameters:
+ - name: email
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: OK
diff --git a/src/test/resources/checks/v31/security/OAR083/valid-query-params.json b/src/test/resources/checks/v31/security/OAR083/valid-query-params.json
new file mode 100644
index 00000000..54fc86bd
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/valid-query-params.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR083/valid-query-params.yaml b/src/test/resources/checks/v31/security/OAR083/valid-query-params.yaml
new file mode 100644
index 00000000..062797ee
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR083/valid-query-params.yaml
@@ -0,0 +1,26 @@
+ openapi: "3.1.0"
+ info:
+ version: 1.0.0
+ title: My API
+ paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.json b/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.json
new file mode 100644
index 00000000..16c82134
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "exampleParam1",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "password" # Noncompliant {{OAR084: The format password should not pass through this querystring}}
+ }
+ },
+ {
+ "name": "param3",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.yaml b/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.yaml
new file mode 100644
index 00000000..c7369437
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/forbidden-query-formats.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: password # Noncompliant {{OAR084: The format password should not pass through this querystring}}
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR084/no-parameters.json b/src/test/resources/checks/v31/security/OAR084/no-parameters.json
new file mode 100644
index 00000000..df629c67
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/no-parameters.json
@@ -0,0 +1,17 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": { "description": "A list of items" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR084/no-parameters.yaml b/src/test/resources/checks/v31/security/OAR084/no-parameters.yaml
new file mode 100644
index 00000000..54deb746
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v31/security/OAR084/non-query-param.json b/src/test/resources/checks/v31/security/OAR084/non-query-param.json
new file mode 100644
index 00000000..386312cd
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/non-query-param.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "summary": "Get an item",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ ],
+ "responses": {
+ "200": { "description": "An item" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR084/non-query-param.yaml b/src/test/resources/checks/v31/security/OAR084/non-query-param.yaml
new file mode 100644
index 00000000..73e94d4c
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/non-query-param.yaml
@@ -0,0 +1,18 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples/{id}:
+ get:
+ summary: Get an item
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ format: password
+ responses:
+ 200:
+ description: An item
diff --git a/src/test/resources/checks/v31/security/OAR084/null-format-param.json b/src/test/resources/checks/v31/security/OAR084/null-format-param.json
new file mode 100644
index 00000000..9f7982c8
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/null-format-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "exampleParam1",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": null
+ }
+ }
+ ],
+ "responses": {
+ "200": { "description": "A list of items" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR084/null-format-param.yaml b/src/test/resources/checks/v31/security/OAR084/null-format-param.yaml
new file mode 100644
index 00000000..20672afb
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/null-format-param.yaml
@@ -0,0 +1,17 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: ~
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v31/security/OAR084/valid-query-formats.json b/src/test/resources/checks/v31/security/OAR084/valid-query-formats.json
new file mode 100644
index 00000000..54fc86bd
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/valid-query-formats.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR084/valid-query-formats.yaml b/src/test/resources/checks/v31/security/OAR084/valid-query-formats.yaml
new file mode 100644
index 00000000..3bd175a2
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR084/valid-query-formats.yaml
@@ -0,0 +1,27 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: date
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.json b/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.json
new file mode 100644
index 00000000..c7ccf855
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.yaml b/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.yaml
new file mode 100644
index 00000000..a2a53635
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR085/invalid-openapi-version.yaml
@@ -0,0 +1,6 @@
+openapi: "3.1.0"
+info:
+ title: Sample API
+ description: This is a sample API.
+ version: 1.0.0
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR085/truly-invalid.json b/src/test/resources/checks/v31/security/OAR085/truly-invalid.json
new file mode 100644
index 00000000..e7637d72
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR085/truly-invalid.json
@@ -0,0 +1,9 @@
+{
+ "openapi": "4.0.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API with an invalid openapi version.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
diff --git a/src/test/resources/checks/v31/security/OAR085/truly-invalid.yaml b/src/test/resources/checks/v31/security/OAR085/truly-invalid.yaml
new file mode 100644
index 00000000..d9dbb374
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR085/truly-invalid.yaml
@@ -0,0 +1,6 @@
+openapi: "4.0.0"
+info:
+ title: Sample API
+ description: This is a sample API with an invalid openapi version.
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.json b/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.json
new file mode 100644
index 00000000..30220a58
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.yaml b/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.yaml
index a6105909..a2a53635 100644
--- a/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.yaml
+++ b/src/test/resources/checks/v31/security/OAR085/valid-openapi-version.yaml
@@ -1,4 +1,4 @@
-openapi: 3.1.0
+openapi: "3.1.0"
info:
title: Sample API
description: This is a sample API.
diff --git a/src/test/resources/checks/v31/security/OAR096/valid.json b/src/test/resources/checks/v31/security/OAR096/valid.json
new file mode 100644
index 00000000..09460094
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR096/valid.json
@@ -0,0 +1,117 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": [
+
+ ]
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "403": {
+ "description": "Forbidden"
+ },
+ "429": {
+ "description": "Forbidden"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "429": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR096/valid.yaml b/src/test/resources/checks/v31/security/OAR096/valid.yaml
new file mode 100644
index 00000000..ff056dea
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR096/valid.yaml
@@ -0,0 +1,70 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 403:
+ description: Forbidden
+ 429:
+ description: Forbidden
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 429:
+ description: Unauthorized
+ /without:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.json b/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.json
new file mode 100644
index 00000000..eafd7b70
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.json
@@ -0,0 +1,100 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": { # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.yaml b/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.yaml
new file mode 100644
index 00000000..1c193c85
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR096/without-authorization-responses.yaml
@@ -0,0 +1,62 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /without:
+ get:
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v31/security/OAR114/valid.json b/src/test/resources/checks/v31/security/OAR114/valid.json
new file mode 100644
index 00000000..bb6c4fef
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/valid.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Valid Response Headers Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-api-key": {
+ "description": "Mandatory header",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "traceId": {
+ "description": "Optional but allowed",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR114/valid.yaml b/src/test/resources/checks/v31/security/OAR114/valid.yaml
new file mode 100644
index 00000000..ebf4dc89
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/valid.yaml
@@ -0,0 +1,19 @@
+openapi: "3.1.0"
+info:
+ title: Valid Response Headers Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200":
+ description: OK
+ headers:
+ x-api-key:
+ description: Mandatory header
+ schema:
+ type: string
+ traceId:
+ description: Optional but allowed
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.json b/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.json
new file mode 100644
index 00000000..ce5661ff
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Forbidden Header Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ "description": "OK",
+ "headers": {
+ "Authorization": { # Noncompliant {{OAR114: Header not allowed}}
+ "description": "Forbidden header",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.yaml b/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.yaml
new file mode 100644
index 00000000..0922909e
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/with-forbidden-params.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ title: Forbidden Header Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200": # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ description: OK
+ headers:
+ Authorization: # Noncompliant {{OAR114: Header not allowed}}
+ description: Forbidden header
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v31/security/OAR114/without-required-params.json b/src/test/resources/checks/v31/security/OAR114/without-required-params.json
new file mode 100644
index 00000000..f765239e
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/without-required-params.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.1.0",
+ "info": {
+ "title": "Missing Mandatory Header Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ "description": "OK",
+ "headers": {
+ "traceId": {
+ "description": "Allowed header",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/security/OAR114/without-required-params.yaml b/src/test/resources/checks/v31/security/OAR114/without-required-params.yaml
new file mode 100644
index 00000000..b06bf009
--- /dev/null
+++ b/src/test/resources/checks/v31/security/OAR114/without-required-params.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ title: Missing Mandatory Header Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200": # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ description: OK
+ headers:
+ traceId:
+ description: Allowed header
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.json b/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.json
new file mode 100644
index 00000000..6d641114
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ ] # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.yaml b/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.yaml
new file mode 100644
index 00000000..ba7361a2
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-empty-scopes.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes: [] # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.json b/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.json
new file mode 100644
index 00000000..908f4d15
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : null # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.yaml b/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.yaml
new file mode 100644
index 00000000..7a4f6a37
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-null-scopes.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes: null # Noncompliant {{OAR002: WSO2 scopes definition is wrong}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-scopes.json b/src/test/resources/checks/v32/apim/OAR002/with-scopes.json
new file mode 100644
index 00000000..b5574cef
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-scopes.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ { # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ "name" : "read",
+ "roles" : "ROLE_READ"
+ }, { # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ "name" : "write",
+ "key" : "write"
+ }, { # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ "key" : "view",
+ "roles" : "ROLE_VIEW"
+ }, {
+ "name" : "read2",
+ "roles" : "ROLE_READ_2",
+ "key" : null # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ }, {
+ "name" : "write2",
+ "key" : "write2",
+ "roles" : null # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ }, {
+ "key" : "view2",
+ "roles" : "ROLE_VIEW_2",
+ "name" : null # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/with-scopes.yaml b/src/test/resources/checks/v32/apim/OAR002/with-scopes.yaml
new file mode 100644
index 00000000..c853ee55
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/with-scopes.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ roles: ROLE_READ
+ - name: write # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ key: write
+ - key: view # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
+ roles: ROLE_VIEW
+ - name: read2
+ roles: ROLE_READ_2
+ key: null # Noncompliant {{OAR002: WSO2 scope 'key' is required}}
+ - name: write2
+ key: write2
+ roles: null # Noncompliant {{OAR002: WSO2 scope 'roles' is required}}
+ - key: view2
+ roles: ROLE_VIEW_2
+ name: null # Noncompliant {{OAR002: WSO2 scope 'name' is required}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/without-scopes.json b/src/test/resources/checks/v32/apim/OAR002/without-scopes.json
new file mode 100644
index 00000000..56132180
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/without-scopes.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : null
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/without-scopes.yaml b/src/test/resources/checks/v32/apim/OAR002/without-scopes.yaml
new file mode 100644
index 00000000..75f25193
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/without-scopes.yaml
@@ -0,0 +1,9 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim: null
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/without-security.json b/src/test/resources/checks/v32/apim/OAR002/without-security.json
new file mode 100644
index 00000000..8e69c573
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/without-security.json
@@ -0,0 +1,10 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR002/without-security.yaml b/src/test/resources/checks/v32/apim/OAR002/without-security.yaml
new file mode 100644
index 00000000..79b0852a
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR002/without-security.yaml
@@ -0,0 +1,6 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/with-description.json b/src/test/resources/checks/v32/apim/OAR003/with-description.json
new file mode 100644
index 00000000..2af641e7
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/with-description.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ",
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/with-description.yaml b/src/test/resources/checks/v32/apim/OAR003/with-description.yaml
new file mode 100644
index 00000000..7b9e69d6
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/with-description.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/with-null-description.json b/src/test/resources/checks/v32/apim/OAR003/with-null-description.json
new file mode 100644
index 00000000..5c8b8501
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/with-null-description.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ",
+ "description" : null # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/with-null-description.yaml b/src/test/resources/checks/v32/apim/OAR003/with-null-description.yaml
new file mode 100644
index 00000000..74460897
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/with-null-description.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ
+ description: null # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/without-description.json b/src/test/resources/checks/v32/apim/OAR003/without-description.json
new file mode 100644
index 00000000..5e529018
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/without-description.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ { # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR003/without-description.yaml b/src/test/resources/checks/v32/apim/OAR003/without-description.yaml
new file mode 100644
index 00000000..66f7ac73
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR003/without-description.yaml
@@ -0,0 +1,13 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read # Noncompliant {{OAR003: WSO2 scope 'description' is recommended}}
+ key: read
+ roles: ROLE_READ
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.json b/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.json
new file mode 100644
index 00000000..8174b636
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROL€_V¡€U" ], # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.yaml b/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.yaml
new file mode 100644
index 00000000..d87427fd
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-invalid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.json b/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.json
new file mode 100644
index 00000000..629afce2
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ, ROL€_V¡€U", # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.yaml b/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.yaml
new file mode 100644
index 00000000..e768acea
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-invalid-roles.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ, ROL€_V¡€U # Noncompliant {{OAR004: WSO2 scope roles value is not valid}}
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.json b/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.json
new file mode 100644
index 00000000..50a8ea65
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : [ "ROLE_READ", "ROLE_VIEW" ],
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.yaml b/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.yaml
new file mode 100644
index 00000000..b9e95562
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-valid-array-roles.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles:
+ - ROLE_READ
+ - ROLE_VIEW
+ description: Allows users to read records
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.json b/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.json
new file mode 100644
index 00000000..4529ea9c
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "read",
+ "key" : "read",
+ "roles" : "ROLE_READ, ROLE_VIEW",
+ "description" : "Allows users to read records"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.yaml b/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.yaml
new file mode 100644
index 00000000..d53bf3ed
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR004/with-valid-roles.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: read
+ key: read
+ roles: ROLE_READ, ROLE_VIEW
+ description: Allows users to read records
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.json b/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.json
new file mode 100644
index 00000000..577f79bb
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two"
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.yaml b/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.yaml
new file mode 100644
index 00000000..76ddb4b8
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-correct-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.json b/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.json
new file mode 100644
index 00000000..67db4f6a
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : null # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.yaml b/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.yaml
new file mode 100644
index 00000000..90fcef4d
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-null-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: null # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.json b/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.json
new file mode 100644
index 00000000..b65690cf
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_five" # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two, role_x"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.yaml b/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.yaml
new file mode 100644
index 00000000..fe9139f5
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR005/with-wrong-operation-scope.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_five # Noncompliant {{OAR005: WSO2 scope definition does not exists}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two, role_x
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR040/invalid.json b/src/test/resources/checks/v32/apim/OAR040/invalid.json
new file mode 100644
index 00000000..2f56af18
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR040/invalid.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "app" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "app1_sc_ran" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "GENE_Sc_ran" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ }, {
+ "name" : "X_SC_A" # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR040/invalid.yaml b/src/test/resources/checks/v32/apim/OAR040/invalid.yaml
new file mode 100644
index 00000000..177ea034
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR040/invalid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: app # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: app1_sc_ran # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: GENE_Sc_ran # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
+ - name: X_SC_A # Noncompliant {{OAR040: WSO2 scope name value is non compliant with the standard}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR040/valid.json b/src/test/resources/checks/v32/apim/OAR040/valid.json
new file mode 100644
index 00000000..05949043
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR040/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "xfcn_sc_1"
+ }, {
+ "name" : "GENGA_SC_RE1"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR040/valid.yaml b/src/test/resources/checks/v32/apim/OAR040/valid.yaml
new file mode 100644
index 00000000..58747996
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR040/valid.yaml
@@ -0,0 +1,12 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: xfcn_sc_1
+ - name: GENGA_SC_RE1
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.json b/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.json
new file mode 100644
index 00000000..5eb6d369
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two",
+ "x-auth-type" : "Application"
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.yaml b/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.yaml
new file mode 100644
index 00000000..75d6f9f9
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/with-scope-and-auth.yaml
@@ -0,0 +1,24 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two
+ x-auth-type: "Application"
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.json b/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.json
new file mode 100644
index 00000000..8b8048e4
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ },
+ "x-scope" : "scope_two" # Noncompliant {{OAR041: WSO2 x-scope requires x-auth-type definition}}
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.yaml b/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.yaml
new file mode 100644
index 00000000..da723b86
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/with-scope-without-auth.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ x-scope: scope_two # Noncompliant {{OAR041: WSO2 x-scope requires x-auth-type definition}}
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.json b/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.json
new file mode 100644
index 00000000..c362314d
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ },
+ "x-wso2-security" : {
+ "apim" : {
+ "x-wso2-scopes" : [ {
+ "name" : "scope_one",
+ "description" : "scope_one",
+ "key" : "scope_one",
+ "roles" : "role_one"
+ }, {
+ "name" : "scope_two",
+ "description" : "scope_two",
+ "key" : "scope_two",
+ "roles" : "role_two"
+ } ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.yaml b/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.yaml
new file mode 100644
index 00000000..587a48e8
--- /dev/null
+++ b/src/test/resources/checks/v32/apim/OAR041/without-scope-and-auth.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+x-wso2-security:
+ apim:
+ x-wso2-scopes:
+ - name: scope_one
+ description: scope_one
+ key: scope_one
+ roles: role_one
+ - name: scope_two
+ description: scope_two
+ key: scope_two
+ roles: role_two
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR044/media-type.json b/src/test/resources/checks/v32/core/OAR044/media-type.json
new file mode 100644
index 00000000..517db4d8
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR044/media-type.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "requestBody" : {
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ "text/*" : { }
+ }
+ },
+ "responses" : {
+ "200" : {
+ "description" : "some operation",
+ "content" : {
+ "application" : { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ }
+ }
+ },
+ "parameters" : [ {
+ "name" : "someParam",
+ "in" : "query",
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ "text/plain" : { }
+ }
+ }, {
+ "name" : "otherParam",
+ "in" : "path"
+ } ]
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "some operation"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR044/media-type.yaml b/src/test/resources/checks/v32/core/OAR044/media-type.yaml
new file mode 100644
index 00000000..22b32de1
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR044/media-type.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ requestBody:
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+# ^^^^^^^^^^^^^
+ 'text/*': {}
+ responses:
+ '200':
+ description: some operation
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ parameters:
+ - name: someParam
+ in: query
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ 'text/plain': {} # invalid (only 1 content allowed by spec), but should not be caught by this rule
+ - name: otherParam
+ in: path
+ post:
+ responses:
+ '200':
+ description: some operation
diff --git a/src/test/resources/checks/v32/core/OAR045/defined-response.json b/src/test/resources/checks/v32/core/OAR045/defined-response.json
new file mode 100644
index 00000000..b19ef64b
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/core/OAR045/defined-response.yaml b/src/test/resources/checks/v32/core/OAR045/defined-response.yaml
new file mode 100644
index 00000000..14f08cea
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v32/core/OAR046/declared-tag.json b/src/test/resources/checks/v32/core/OAR046/declared-tag.json
new file mode 100644
index 00000000..e21e1581
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR046/declared-tag.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag" ],
+ "responses" : { }
+ },
+ "post" : { # Noncompliant {{OAR046: Associate a tag to this operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR046/declared-tag.yaml b/src/test/resources/checks/v32/core/OAR046/declared-tag.yaml
new file mode 100644
index 00000000..060d6d42
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR046/declared-tag.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ responses: {}
+ post: # Noncompliant {{OAR046: Associate a tag to this operation}}
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR047/documented-tag.json b/src/test/resources/checks/v32/core/OAR047/documented-tag.json
new file mode 100644
index 00000000..cf201de0
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR047/documented-tag.json
@@ -0,0 +1,24 @@
+{
+ "openapi" : "3.2.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ }, {
+ "name" : "undescribed-tag" # Noncompliant {{OAR047: Add a short description to this tag}}
+ }, {
+ "name" : "used-tag", # Noncompliant [[secondary=-3]] {{OAR047: Remove this duplicate tag}}
+ "description" : "another description"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag", "undescribed-tag", "unlisted-tag" ], # Noncompliant {{OAR047: This tag should be declared in the tags section of the contract}}
+ "responses" : { }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR047/documented-tag.yaml b/src/test/resources/checks/v32/core/OAR047/documented-tag.yaml
new file mode 100644
index 00000000..dff72922
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR047/documented-tag.yaml
@@ -0,0 +1,18 @@
+openapi: "3.2.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+- name: undescribed-tag # Noncompliant {{OAR047: Add a short description to this tag}}
+- name: used-tag # Noncompliant [[secondary=-3]] {{OAR047: Remove this duplicate tag}}
+ description: another description
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ - undescribed-tag
+ - unlisted-tag # Noncompliant {{OAR047: This tag should be declared in the tags section of the contract}}
+ responses: {}
diff --git a/src/test/resources/checks/v32/core/OAR049/no-content-in-204.json b/src/test/resources/checks/v32/core/OAR049/no-content-in-204.json
new file mode 100644
index 00000000..a8697a7e
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR049/no-content-in-204.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/other-pets/{petId}" : {
+ "delete" : {
+ "responses" : {
+ "204" : { # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ "description" : "delete pet",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "type" : "object"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR049/no-content-in-204.yaml b/src/test/resources/checks/v32/core/OAR049/no-content-in-204.yaml
new file mode 100644
index 00000000..a88e34a7
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR049/no-content-in-204.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /other-pets/{petId}:
+ delete:
+ responses:
+ '204': # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ description: delete pet
+ content:
+ 'application/json':
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v32/core/OAR050/provide-summary.json b/src/test/resources/checks/v32/core/OAR050/provide-summary.json
new file mode 100644
index 00000000..c1387e0c
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR050/provide-summary.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : { # Noncompliant {{OAR050: Provide a summary for each operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR050/provide-summary.yaml b/src/test/resources/checks/v32/core/OAR050/provide-summary.yaml
new file mode 100644
index 00000000..62b1a87e
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR050/provide-summary.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR050: Provide a summary for each operation}}
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR051/different-description.json b/src/test/resources/checks/v32/core/OAR051/different-description.json
new file mode 100644
index 00000000..652c891f
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR051/different-description.json
@@ -0,0 +1,30 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "summary" : "create a pet",
+ "description" : "Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other operations.",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "List all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/core/OAR051/different-description.yaml b/src/test/resources/checks/v32/core/OAR051/different-description.yaml
new file mode 100644
index 00000000..645dfc1f
--- /dev/null
+++ b/src/test/resources/checks/v32/core/OAR051/different-description.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ summary: create a pet
+ description: Create a new pet. The pet type is assigned a new unique ID, and can then be referenced in other
+ operations.
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: List all pets
+# ^^^^^^^^^^^
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR031/allof-schema.json b/src/test/resources/checks/v32/examples/OAR031/allof-schema.json
new file mode 100644
index 00000000..48d27955
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/allof-schema.json
@@ -0,0 +1,55 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components" : {
+ "schemas" : {
+ "BaseEntity" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "integer",
+ "example" : 1
+ }
+ }
+ },
+ "Pet" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/BaseEntity"
+ } ],
+ "properties" : {
+ "name" : {
+ "type" : "string",
+ "example" : "Fluffy"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "$ref" : "#/components/schemas/Pet"
+ },
+ "example" : {
+ "name" : "Fluffy"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/examples/OAR031/allof-schema.yaml b/src/test/resources/checks/v32/examples/OAR031/allof-schema.yaml
new file mode 100644
index 00000000..388704e9
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/allof-schema.yaml
@@ -0,0 +1,33 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ schemas:
+ BaseEntity:
+ type: object
+ properties:
+ id:
+ type: integer
+ example: 1
+ Pet:
+ allOf:
+ - $ref: '#/components/schemas/BaseEntity'
+ properties:
+ name:
+ type: string
+ example: "Fluffy"
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ example:
+ name: Fluffy
+ 204:
+ description: No content
diff --git a/src/test/resources/checks/v32/examples/OAR031/externalref.yaml b/src/test/resources/checks/v32/examples/OAR031/externalref.yaml
new file mode 100644
index 00000000..126feb8a
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/externalref.yaml
@@ -0,0 +1,68 @@
+openapi: "3.2.0"
+info:
+ title: Example API
+ description: This is a basic example of an OpenAPI document.
+ version: 1.0.0
+servers:
+ - url: https://api.example.com/v1
+ description: Main (production) server
+ - url: https://api.staging.example.com
+ description: Staging server
+paths:
+ /users:
+ get:
+ summary: Get all users
+ description: Returns a list of users.
+ responses:
+ '200':
+ description: A JSON array of user objects
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/User'
+ '400':
+ $ref: >- # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ http://localhost:18089/OAR031.yaml#/components/responses/server_error_response
+ /users/{userId}:
+ get:
+ summary: Get a user by ID
+ description: Returns a single user.
+ parameters:
+ - name: userId
+ in: path
+ required: true
+ description: The ID of the user to retrieve
+ schema:
+ type: string
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ '200':
+ description: A single user object
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ '400':
+ $ref: >- # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ http://localhost:18089/OAR031.yaml#/components/responses/server_error_response
+components:
+ schemas:
+ User:
+ type: object
+ required:
+ - id
+ - name
+ properties:
+ id:
+ type: string
+ example: '12345'
+ name:
+ type: string
+ example: 'John Doe'
+ email:
+ type: string
+ example: 'john.doe@example.com'
diff --git a/src/test/resources/checks/v32/examples/OAR031/nested-properties-examples.yaml b/src/test/resources/checks/v32/examples/OAR031/nested-properties-examples.yaml
new file mode 100644
index 00000000..34233555
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/nested-properties-examples.yaml
@@ -0,0 +1,39 @@
+openapi: "3.2.0"
+info:
+ title: OAR031 Nested Examples
+ version: 1.0.0
+paths:
+ /profile:
+ put:
+ summary: Update user profile
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ email:
+ type: string
+ example: "apellido@madrid.org"
+ telefono_fijo:
+ type: string
+ example: "600345345"
+ direccion:
+ type: object
+ properties:
+ calle:
+ type: string
+ example: "Calle Indeterminada, 18"
+ localidad:
+ type: string
+ example: "Madrid"
+ provincia:
+ type: string
+ example: "Madrid"
+ codigo_postal:
+ type: string
+ example: "28001"
+ responses:
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR031/valid.json b/src/test/resources/checks/v32/examples/OAR031/valid.json
new file mode 100644
index 00000000..a63ef7d1
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/valid.json
@@ -0,0 +1,170 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ },
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Pet created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ },
+ "example": {
+ "size": 2,
+ "pets": [
+ {
+ "name": "Fluffy",
+ "type": "cat"
+ },
+ {
+ "name": "Sparky",
+ "type": "dog"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Fluffy",
+ "type": "cat"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true,
+ "example": 513168138
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "Snow"
+ },
+ "type": {
+ "type": "string",
+ "example": "dog"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": {
+ "type": "integer",
+ "example": 1
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": {
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "example": "Server error"
+ }
+ }
+ },
+ "example": {
+ "error": "Server error"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR031/valid.yaml b/src/test/resources/checks/v32/examples/OAR031/valid.yaml
new file mode 100644
index 00000000..5dc80af7
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/valid.yaml
@@ -0,0 +1,113 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ 201:
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pet'
+ example:
+ name: Puppy
+ type: dog
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+ get:
+ responses:
+ 204:
+ description: No content
+ 206:
+ description: Pet created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ example:
+ size: 2
+ pets:
+ - name: Fluffy
+ type: cat
+ - name: Sparky
+ type: dog
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200:
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Fluffy
+ type: cat
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ example: 513168138
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+
+ schemas:
+ pet:
+ type: object
+ properties:
+ name:
+ type: string
+ example: "Snow"
+ type:
+ type: string
+ example: "dog"
+ pets:
+ type: object
+ properties:
+ size:
+ type: integer
+ example: 1
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error:
+ type: string
+ example: "Server error"
+ example:
+ error: "Server error"
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR031/without-examples.json b/src/test/resources/checks/v32/examples/OAR031/without-examples.json
new file mode 100644
index 00000000..e125ca1a
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/without-examples.json
@@ -0,0 +1,120 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "parameters": [
+ { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "query",
+ "name": "$start",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ },
+ "type": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "integer"
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR031/without-examples.yaml b/src/test/resources/checks/v32/examples/OAR031/without-examples.yaml
new file mode 100644
index 00000000..9f62c796
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR031/without-examples.yaml
@@ -0,0 +1,73 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ parameters:
+ - in: query # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: $start
+ schema:
+ type: integer
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+ schemas:
+ pet:
+ type: object
+ properties:
+ name: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ type: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ pets:
+ type: object
+ properties:
+ size: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: integer
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR094/externalref.yaml b/src/test/resources/checks/v32/examples/OAR094/externalref.yaml
new file mode 100644
index 00000000..5acf5c5b
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR094/externalref.yaml
@@ -0,0 +1,62 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR094.yaml#/components/schemas/Pet
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR094.yaml#/components/schemas/ErrorMessage
+ example: # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR094/invalid-example.json b/src/test/resources/checks/v32/examples/OAR094/invalid-example.json
new file mode 100644
index 00000000..0ea37ff9
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR094/invalid-example.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API con Example",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Devuelve una lista de mascotas",
+ "responses": {
+ "200": {
+ "description": "Lista exitosa de mascotas",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ },
+ "example": [ # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ {
+ "name": "Whiskers",
+ "animalType": "Cat"
+ },
+ {
+ "name": "Daisy",
+ "animalType": "Dog"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "animalType": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR094/invalid-example.yaml b/src/test/resources/checks/v32/examples/OAR094/invalid-example.yaml
new file mode 100644
index 00000000..d9522a84
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR094/invalid-example.yaml
@@ -0,0 +1,31 @@
+openapi: "3.2.0"
+info:
+ title: API con Example
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Devuelve una lista de mascotas
+ responses:
+ '200':
+ description: Lista exitosa de mascotas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ example: # Noncompliant {{OAR094: It is recommended to use examples instead of example as some tools like microcks use this section of the definition}}
+ - name: Whiskers
+ animalType: Cat
+ - name: Daisy
+ animalType: Dog
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ name:
+ type: string
+ animalType:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR094/valid-example.json b/src/test/resources/checks/v32/examples/OAR094/valid-example.json
new file mode 100644
index 00000000..6a7b00f2
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR094/valid-example.json
@@ -0,0 +1,62 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API con Examples",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Devuelve una lista de mascotas",
+ "responses": {
+ "200": {
+ "description": "Lista exitosa de mascotas",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ },
+ "examples": {
+ "catExample": {
+ "value": [
+ {
+ "name": "Whiskers",
+ "animalType": "Cat"
+ }
+ ]
+ },
+ "dogExample": {
+ "value": [
+ {
+ "name": "Daisy",
+ "animalType": "Dog"
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "animalType": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/examples/OAR094/valid-example.yaml b/src/test/resources/checks/v32/examples/OAR094/valid-example.yaml
new file mode 100644
index 00000000..886cbd6c
--- /dev/null
+++ b/src/test/resources/checks/v32/examples/OAR094/valid-example.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ title: API con Examples
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Devuelve una lista de mascotas
+ responses:
+ '200':
+ description: Lista exitosa de mascotas
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Pet'
+ examples:
+ catExample:
+ value:
+ - name: Whiskers
+ animalType: Cat
+ dogExample:
+ value:
+ - name: Daisy
+ animalType: Dog
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ name:
+ type: string
+ animalType:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR006/without-anything.json b/src/test/resources/checks/v32/format/OAR006/without-anything.json
new file mode 100644
index 00000000..50955fd1
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR006/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": { # Noncompliant {{OAR006: Section requestBody is mandatory}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR006/without-anything.yaml b/src/test/resources/checks/v32/format/OAR006/without-anything.yaml
new file mode 100644
index 00000000..bc9fd61a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR006/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR006: Section requestBody is mandatory}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR007/without-anything.json b/src/test/resources/checks/v32/format/OAR007/without-anything.json
new file mode 100644
index 00000000..966f50d5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR007/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR007: Section content is mandatory}}
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR007/without-anything.yaml b/src/test/resources/checks/v32/format/OAR007/without-anything.yaml
new file mode 100644
index 00000000..371c1c66
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR007/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200: # Noncompliant {{OAR007: Section content is mandatory}}
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.json b/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.json
new file mode 100644
index 00000000..8e2f6bfb
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": { # Noncompliant {{OAR009: requestBody not allowed with operation 'GET'}}
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.yaml b/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.yaml
new file mode 100644
index 00000000..f4f4a3d9
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/operation-not-allows-request-body.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get: # Noncompliant {{OAR009: requestBody not allowed with operation 'GET'}}
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.json b/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.json
new file mode 100644
index 00000000..4c489b99
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.json
@@ -0,0 +1,43 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.yaml b/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.yaml
new file mode 100644
index 00000000..941a5847
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-default-and-$ref.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json: {}
+ application/xml: {}
+paths:
+ /pets:
+ post:
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ description: Ok
+ put:
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.json b/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.json
new file mode 100644
index 00000000..5ba4bfd6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/xml": {},
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.yaml b/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.yaml
new file mode 100644
index 00000000..286b32cb
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-default-and-specific.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content:
+ application/xml: {}
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-specific.json b/src/test/resources/checks/v32/format/OAR009/with-specific.json
new file mode 100644
index 00000000..d364446d
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-specific.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-specific.yaml b/src/test/resources/checks/v32/format/OAR009/with-specific.yaml
new file mode 100644
index 00000000..62f5e19c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-specific.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.json b/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.json
new file mode 100644
index 00000000..bff8ff05
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/xml": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/owners": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/text": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.yaml
new file mode 100644
index 00000000..a36602b8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-wrong-default-and-specific.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/xml: {}
+ responses:
+ 200:
+ description: Ok
+ /owners:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/text: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-wrong-default.json b/src/test/resources/checks/v32/format/OAR009/with-wrong-default.json
new file mode 100644
index 00000000..9ff912b3
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-wrong-default.json
@@ -0,0 +1,23 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "application/text": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/with-wrong-default.yaml b/src/test/resources/checks/v32/format/OAR009/with-wrong-default.yaml
new file mode 100644
index 00000000..d3f04542
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/with-wrong-default.yaml
@@ -0,0 +1,13 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ application/text: {}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/without-anything.json b/src/test/resources/checks/v32/format/OAR009/without-anything.json
new file mode 100644
index 00000000..87719536
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": { # Noncompliant {{OAR009: Should indicate the default request media type}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR009/without-anything.yaml b/src/test/resources/checks/v32/format/OAR009/without-anything.yaml
new file mode 100644
index 00000000..91bac1df
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR009/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR009: Should indicate the default request media type}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.json b/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.json
new file mode 100644
index 00000000..85e2130a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.json
@@ -0,0 +1,29 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.yaml b/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.yaml
new file mode 100644
index 00000000..664d6ac5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-default-and-$ref.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json: {}
+ application/xml: {}
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/PetsResponse'
diff --git a/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.json b/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.json
new file mode 100644
index 00000000..37caf1ca
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {},
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.yaml b/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.yaml
new file mode 100644
index 00000000..27bf971a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-default-and-specific.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
+ /owners:
+ get:
+ responses:
+ '200':
+ description: Ok
+ content:
+ application/json: {}
+ application/xml: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-specific.json b/src/test/resources/checks/v32/format/OAR010/with-specific.json
new file mode 100644
index 00000000..f2b6fe75
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-specific.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-specific.yaml b/src/test/resources/checks/v32/format/OAR010/with-specific.yaml
new file mode 100644
index 00000000..2fe548f8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-specific.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json: {}
+ /owners:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.json b/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.json
new file mode 100644
index 00000000..d5e1eee5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.json
@@ -0,0 +1,33 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/xml": {}
+ }
+ }
+ }
+ }
+ },
+ "/owners": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/text": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.yaml
new file mode 100644
index 00000000..1bf7e848
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-wrong-default-and-specific.yaml
@@ -0,0 +1,19 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ "/pets":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/xml: {}
+ "/owners":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/text: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-wrong-default.json b/src/test/resources/checks/v32/format/OAR010/with-wrong-default.json
new file mode 100644
index 00000000..ce1531e6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-wrong-default.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "application/text": {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/with-wrong-default.yaml b/src/test/resources/checks/v32/format/OAR010/with-wrong-default.yaml
new file mode 100644
index 00000000..d6eb5bc1
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/with-wrong-default.yaml
@@ -0,0 +1,12 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ "/pets":
+ get:
+ responses:
+ '200':
+ description: Ok
+ content: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ application/text: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/without-anything.json b/src/test/resources/checks/v32/format/OAR010/without-anything.json
new file mode 100644
index 00000000..367c5855
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/without-anything.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR010: Should indicate the default response media type}}
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR010/without-anything.yaml b/src/test/resources/checks/v32/format/OAR010/without-anything.yaml
new file mode 100644
index 00000000..f0c65240
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR010/without-anything.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200: # Noncompliant {{OAR010: Should indicate the default response media type}}
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/base-path-ok.json b/src/test/resources/checks/v32/format/OAR011/base-path-ok.json
new file mode 100644
index 00000000..3d1242d2
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/base-path-ok.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "https://petstore.swagger.io/api-store/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/base-path-ok.yaml b/src/test/resources/checks/v32/format/OAR011/base-path-ok.yaml
new file mode 100644
index 00000000..5bf30cf7
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/base-path-ok.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-store/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/base-path-wrong.json b/src/test/resources/checks/v32/format/OAR011/base-path-wrong.json
new file mode 100644
index 00000000..bfdb7a35
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/base-path-wrong.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "https://petstore.swagger.io/APIStore/v1" # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/base-path-wrong.yaml b/src/test/resources/checks/v32/format/OAR011/base-path-wrong.yaml
new file mode 100644
index 00000000..4b75076f
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/base-path-wrong.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/APIStore/v1 # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/plain.json b/src/test/resources/checks/v32/format/OAR011/plain.json
new file mode 100644
index 00000000..677c41b5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/plain.json
@@ -0,0 +1,90 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets/{id}": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS/{id}": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}/external-info": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/Pets/{id}/EXternal_INFO": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/PETS/{id}/externalInfo": { # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR011/plain.yaml b/src/test/resources/checks/v32/format/OAR011/plain.yaml
new file mode 100644
index 00000000..a0f12431
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR011/plain.yaml
@@ -0,0 +1,50 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets/{id}: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS/{id}: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{id}/external-info:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /Pets/{id}/EXternal_INFO: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /PETS/{id}/externalInfo: # Noncompliant {{OAR011: The base path and resource names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/camel-case-plain.json b/src/test/resources/checks/v32/format/OAR012/camel-case-plain.json
new file mode 100644
index 00000000..1bc9c4c0
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/camel-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/camel-case-plain.yaml b/src/test/resources/checks/v32/format/OAR012/camel-case-plain.yaml
new file mode 100644
index 00000000..efa4e09a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/camel-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: path
+ name: petId
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: path
+ name: petId
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.json b/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.json
new file mode 100644
index 00000000..7a034d36
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-Type", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ },
+ "petAge": {
+ "type": "number"
+ },
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.yaml b/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.yaml
new file mode 100644
index 00000000..e01fdd5a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/camel-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: camelCase}}
+ type: string
+ petAge:
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.json b/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.json
new file mode 100644
index 00000000..c093ed08
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.yaml b/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.yaml
new file mode 100644
index 00000000..0db93daa
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/kebab-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.json b/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.json
new file mode 100644
index 00000000..711c1557
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-type",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": {
+ "type": "string"
+ },
+ "petAge": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "number"
+ },
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.yaml b/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.yaml
new file mode 100644
index 00000000..b5ce1f58
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/kebab-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: kebab-case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/snake-case-plain.json b/src/test/resources/checks/v32/format/OAR012/snake-case-plain.json
new file mode 100644
index 00000000..81c68011
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/snake-case-plain.json
@@ -0,0 +1,136 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "EXPAND-INFO", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "query",
+ "name": "expandInfo3", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/snake-case-plain.yaml b/src/test/resources/checks/v32/format/OAR012/snake-case-plain.yaml
new file mode 100644
index 00000000..a12a75cc
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/snake-case-plain.yaml
@@ -0,0 +1,78 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: path
+ name: pet_id
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: path
+ name: pet_id
+ schema:
+ type: integer
+ - in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expand_info
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: EXPAND-INFO # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: query
+ name: expandInfo3 # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ - in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.json b/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.json
new file mode 100644
index 00000000..9ea66ba2
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.json
@@ -0,0 +1,209 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "petType": {
+ "in": "path",
+ "name": "pet-Type", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamOk": {
+ "in": "path",
+ "name": "petId", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong1": {
+ "in": "path",
+ "name": "pet_id",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "pathParamWrong2": {
+ "in": "path",
+ "name": "PET-ID", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamOk": {
+ "in": "query",
+ "name": "expandInfo", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong1": {
+ "in": "query",
+ "name": "expand_info",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "queryParamWrong2": {
+ "in": "query",
+ "name": "expand-info", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "integer"
+ }
+ },
+ "headerParam": {
+ "in": "header",
+ "name": "X-Request-ID",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ },
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "pet-type": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ },
+ "petAge": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "number"
+ },
+ "pet_name": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requestBodies": {
+ "PetsPostRequest": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/petType"
+ },
+ {
+ "in": "path",
+ "name": "petName", # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "post": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/pathParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/pathParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamOk"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong1"
+ },
+ {
+ "$ref": "#/components/parameters/queryParamWrong2"
+ },
+ {
+ "$ref": "#/components/parameters/headerParam"
+ }
+ ],
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetsPostRequest"
+ },
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ }
+ }
+ },
+ "put": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "pet_name": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "petName": { # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ "type": "string"
+ }
+ }
+ }
+ },
+ "application/xml": {
+ "schema": {
+ "$ref": "#/components/schemas/Pet"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.yaml b/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.yaml
new file mode 100644
index 00000000..59498c29
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR012/snake-case-with-$ref.yaml
@@ -0,0 +1,130 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ petType:
+ in: path
+ name: pet-Type # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ pathParamOk:
+ in: path
+ name: petId # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ pathParamWrong1:
+ in: path
+ name: pet_id
+ schema:
+ type: integer
+ pathParamWrong2:
+ in: path
+ name: PET-ID # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ queryParamOk:
+ in: query
+ name: expandInfo # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ queryParamWrong1:
+ in: query
+ name: expand_info
+ schema:
+ type: integer
+ queryParamWrong2:
+ in: query
+ name: expand-info # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: integer
+ headerParam:
+ in: header
+ name: X-Request-ID
+ schema:
+ type: string
+ required: true
+ schemas:
+ Pet:
+ type: object
+ properties:
+ pet-type: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ pet_name:
+ type: string
+ requestBodies:
+ PetsPostRequest:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ responses:
+ PetsResponse:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ petName: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: string
+
+paths:
+ /pets:
+ parameters:
+ - $ref: "#/components/parameters/petType"
+ - in: path
+ name: petName # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ schema:
+ type: string
+ post:
+ parameters:
+ - $ref: '#/components/parameters/pathParamOk'
+ - $ref: '#/components/parameters/pathParamWrong1'
+ - $ref: '#/components/parameters/pathParamWrong2'
+ - $ref: '#/components/parameters/queryParamOk'
+ - $ref: '#/components/parameters/queryParamWrong1'
+ - $ref: '#/components/parameters/queryParamWrong2'
+ - $ref: '#/components/parameters/headerParam'
+ requestBody:
+ $ref: '#/components/requestBodies/PetsPostRequest'
+ responses:
+ 200:
+ $ref: '#/components/responses/PetsResponse'
+ put:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ responses:
+ 200:
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pet_name:
+ type: string
+ petAge: # Noncompliant {{OAR012: Path params names, query params names, object names and property names with more than two words must be compliant with the standard naming convention: snake_case}}
+ type: number
+ application/xml:
+ schema:
+ $ref: '#/components/schemas/Pet'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR016/nested.json b/src/test/resources/checks/v32/format/OAR016/nested.json
new file mode 100644
index 00000000..175e2dcf
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/nested.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR016/nested.yaml b/src/test/resources/checks/v32/format/OAR016/nested.yaml
new file mode 100644
index 00000000..e18ef182
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/nested.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int64
+
diff --git a/src/test/resources/checks/v32/format/OAR016/plain.json b/src/test/resources/checks/v32/format/OAR016/plain.json
new file mode 100644
index 00000000..95dc5876
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "product_id": {
+ "type": "integer", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int32"
+ },
+ "price": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR016/plain.yaml b/src/test/resources/checks/v32/format/OAR016/plain.yaml
new file mode 100644
index 00000000..6cebec67
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/plain.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ product_id:
+ type: integer # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int128
+ line:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int32
+ price:
+ type: number
+ format: double
+
diff --git a/src/test/resources/checks/v32/format/OAR016/with-$ref.json b/src/test/resources/checks/v32/format/OAR016/with-$ref.json
new file mode 100644
index 00000000..ffcb0988
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR016/with-$ref.yaml b/src/test/resources/checks/v32/format/OAR016/with-$ref.yaml
new file mode 100644
index 00000000..0b7a5913
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR016/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR016: Numeric types requires a valid format}}
+ format: int64
diff --git a/src/test/resources/checks/v32/format/OAR037/complete.json b/src/test/resources/checks/v32/format/OAR037/complete.json
new file mode 100644
index 00000000..4b9f4508
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/complete.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "paramOne": {
+ "in": "header",
+ "name": "paramOne",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ },
+ "paramTwo": {
+ "in": "header",
+ "name": "paramTwo",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ },
+ "paths": {
+ "/invoices": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/paramTwo"
+ },
+ {
+ "in": "header",
+ "name": "paramThree",
+ "schema": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/paramOne"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "without": {
+ "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ },
+ "date": {
+ "type": "string",
+ "format": "date"
+ },
+ "date-time": {
+ "type": "string",
+ "format": "date-time"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ },
+ "byte": {
+ "type": "string",
+ "format": "byte"
+ },
+ "binary": {
+ "type": "string",
+ "format": "binary"
+ },
+ "email": {
+ "type": "string",
+ "format": "email"
+ },
+ "uuid": {
+ "type": "string",
+ "format": "uuid"
+ },
+ "uri": {
+ "type": "string",
+ "format": "uri"
+ },
+ "hostname": {
+ "type": "string",
+ "format": "hostname"
+ },
+ "ipv4": {
+ "type": "string",
+ "format": "ipv4"
+ },
+ "ipv6": {
+ "type": "string",
+ "format": "ipv6"
+ },
+ "other": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR037/complete.yaml b/src/test/resources/checks/v32/format/OAR037/complete.yaml
new file mode 100644
index 00000000..2be1bfa4
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/complete.yaml
@@ -0,0 +1,76 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ paramOne:
+ in: header
+ name: paramOne
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+ paramTwo:
+ in: header
+ name: paramTwo
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+paths:
+ /invoices:
+ parameters:
+ - $ref: '#/components/parameters/paramTwo'
+ - in: header
+ name: paramThree
+ schema:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+ get:
+ parameters:
+ - $ref: '#/components/parameters/paramOne'
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ without:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ date:
+ type: string
+ format: date
+ date-time:
+ type: string
+ format: date-time
+ password:
+ type: string
+ format: password
+ byte:
+ type: string
+ format: byte
+ binary:
+ type: string
+ format: binary
+ email:
+ type: string
+ format: email
+ uuid:
+ type: string
+ format: uuid
+ uri:
+ type: string
+ format: uri
+ hostname:
+ type: string
+ format: hostname
+ ipv4:
+ type: string
+ format: ipv4
+ ipv6:
+ type: string
+ format: ipv6
+ other:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v32/format/OAR037/nested.json b/src/test/resources/checks/v32/format/OAR037/nested.json
new file mode 100644
index 00000000..08aa7e31
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/nested.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR037/nested.yaml b/src/test/resources/checks/v32/format/OAR037/nested.yaml
new file mode 100644
index 00000000..8a2d2c6b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/nested.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ nested:
+ type: object
+ properties:
+ value:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
+
diff --git a/src/test/resources/checks/v32/format/OAR037/with-$ref.json b/src/test/resources/checks/v32/format/OAR037/with-$ref.json
new file mode 100644
index 00000000..d88ad1bc
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "format": "YYYY-MM-DD"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml
new file mode 100644
index 00000000..40f2fc10
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v32/format/OAR042/incorrect-version.json b/src/test/resources/checks/v32/format/OAR042/incorrect-version.json
new file mode 100644
index 00000000..544738f8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/incorrect-version.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1.0" # Noncompliant {{OAR042: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/incorrect-version.yaml b/src/test/resources/checks/v32/format/OAR042/incorrect-version.yaml
new file mode 100644
index 00000000..cb41fe1a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/incorrect-version.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1.0 # Noncompliant {{OAR042: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/too-long.json b/src/test/resources/checks/v32/format/OAR042/too-long.json
new file mode 100644
index 00000000..decdde62
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/too-long.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1/vida" # Noncompliant {{OAR042: Path has to many parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/too-long.yaml b/src/test/resources/checks/v32/format/OAR042/too-long.yaml
new file mode 100644
index 00000000..3a05ede8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/too-long.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1/vida # Noncompliant {{OAR042: Path has to many parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/too-short.json b/src/test/resources/checks/v32/format/OAR042/too-short.json
new file mode 100644
index 00000000..b05c3f83
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/too-short.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros" # Noncompliant {{OAR042: Path has to few parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/too-short.yaml b/src/test/resources/checks/v32/format/OAR042/too-short.yaml
new file mode 100644
index 00000000..5cd5092b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/too-short.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros # Noncompliant {{OAR042: Path has to few parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/valid.json b/src/test/resources/checks/v32/format/OAR042/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/valid.yaml b/src/test/resources/checks/v32/format/OAR042/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/without-api-prefix.json b/src/test/resources/checks/v32/format/OAR042/without-api-prefix.json
new file mode 100644
index 00000000..f76cd0f7
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/without-api-prefix.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/seguros/v1" # Noncompliant {{OAR042: API name must start with prefix 'api-'}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR042/without-api-prefix.yaml b/src/test/resources/checks/v32/format/OAR042/without-api-prefix.yaml
new file mode 100644
index 00000000..fabaeb38
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR042/without-api-prefix.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/seguros/v1 # Noncompliant {{OAR042: API name must start with prefix 'api-'}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR044/media-type.json b/src/test/resources/checks/v32/format/OAR044/media-type.json
new file mode 100644
index 00000000..a37e77ee
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR044/media-type.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "some operation",
+ "content" : {
+ "application" : { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ }
+ }
+ },
+ "parameters" : [ {
+ "name" : "someParam",
+ "in" : "query",
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ "text/plain" : { }
+ }
+ },
+ {
+ "name" : "otherParam",
+ "in" : "path"
+ } ]
+ },
+ "post" : {
+ "requestBody" : {
+ "content" : {
+ "application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ "text/*" : { }
+ }
+ },
+ "responses" : {
+ "200" : {
+ "description" : "some operation"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR044/media-type.yaml b/src/test/resources/checks/v32/format/OAR044/media-type.yaml
new file mode 100644
index 00000000..4dc3378b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR044/media-type.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: some operation
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ parameters:
+ - name: someParam
+ in: query
+ content:
+ 'application': {} # Noncompliant {{OAR044: Declared mime type should conform to RFC6838}}
+ 'text/plain': {} # invalid (only 1 content allowed by spec), but should not be caught by this rule
+ - name: otherParam
+ in: path
+ post:
+ requestBody:
+ content:
+ 'application': { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
+ 'text/*': { }
+ responses:
+ '200':
+ description: some operation
diff --git a/src/test/resources/checks/v32/format/OAR050/provide-summary.json b/src/test/resources/checks/v32/format/OAR050/provide-summary.json
new file mode 100644
index 00000000..c1387e0c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR050/provide-summary.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : { # Noncompliant {{OAR050: Provide a summary for each operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR050/provide-summary.yaml b/src/test/resources/checks/v32/format/OAR050/provide-summary.yaml
new file mode 100644
index 00000000..62b1a87e
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR050/provide-summary.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post: # Noncompliant {{OAR050: Provide a summary for each operation}}
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR051/different-description.json b/src/test/resources/checks/v32/format/OAR051/different-description.json
new file mode 100644
index 00000000..39b7066d
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR051/different-description.json
@@ -0,0 +1,31 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "summary" : "create a pet",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "Create a pet",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ },
+ "get" : {
+ "summary" : "list all pets",
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ "description" : "List all pets",
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR051/different-description.yaml b/src/test/resources/checks/v32/format/OAR051/different-description.yaml
new file mode 100644
index 00000000..726898c9
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR051/different-description.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ summary: create a pet
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: Create a pet
+ responses:
+ default:
+ description: the default response
+ get:
+ summary: list all pets
+ # Noncompliant@+1 {{OAR051: Description must differ from summary}}
+ description: List all pets
+# ^^^^^^^^^^^
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR052/nested.json b/src/test/resources/checks/v32/format/OAR052/nested.json
new file mode 100644
index 00000000..c637a9e3
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/nested.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR052/nested.yaml b/src/test/resources/checks/v32/format/OAR052/nested.yaml
new file mode 100644
index 00000000..237c46ed
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/nested.yaml
@@ -0,0 +1,24 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
+
diff --git a/src/test/resources/checks/v32/format/OAR052/plain.json b/src/test/resources/checks/v32/format/OAR052/plain.json
new file mode 100644
index 00000000..414171b9
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/plain.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "product_id": {
+ "type": "integer" # Noncompliant {{OAR052: Numeric types requires a format}}
+ },
+ "line": {
+ "type": "integer" # Noncompliant {{OAR052: Numeric types requires a format}}
+ },
+ "price": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR052/plain.yaml b/src/test/resources/checks/v32/format/OAR052/plain.yaml
new file mode 100644
index 00000000..8c858f7a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/plain.yaml
@@ -0,0 +1,24 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int32
+ product_id:
+ type: integer # Noncompliant {{OAR052: Numeric types requires a format}}
+ line:
+ type: integer # Noncompliant {{OAR052: Numeric types requires a format}}
+ price:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
diff --git a/src/test/resources/checks/v32/format/OAR052/with-$ref.json b/src/test/resources/checks/v32/format/OAR052/with-$ref.json
new file mode 100644
index 00000000..81be7790
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/with-$ref.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number" # Noncompliant {{OAR052: Numeric types requires a format}}
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR052/with-$ref.yaml b/src/test/resources/checks/v32/format/OAR052/with-$ref.yaml
new file mode 100644
index 00000000..44697311
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR052/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR052: Numeric types requires a format}}
diff --git a/src/test/resources/checks/v32/format/OAR066/snake-case-error.json b/src/test/resources/checks/v32/format/OAR066/snake-case-error.json
new file mode 100644
index 00000000..8858ab1a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR066/snake-case-error.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "firstName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "last_name": {
+ "type": "object",
+ "properties": {
+ "streetName": { "type": "string" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "street_name": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "userID": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "user_name": {
+ "type": "object",
+ "properties": {
+ "userId": { "type": "integer" }, # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ "user_id": { "type": "integer" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR066/snake-case-error.yaml b/src/test/resources/checks/v32/format/OAR066/snake-case-error.yaml
new file mode 100644
index 00000000..0d90ec7c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR066/snake-case-error.yaml
@@ -0,0 +1,39 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ firstName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ last_name:
+ type: object
+ properties:
+ streetName: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: string
+ street_name:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ userID: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_name:
+ type: object
+ properties:
+ userId: # Noncompliant {{OAR066: RequestBody and Responses schema property names must be compliant with the snake_case naming convention}}
+ type: integer
+ user_id:
+ type: integer
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR066/valid.json b/src/test/resources/checks/v32/format/OAR066/valid.json
new file mode 100644
index 00000000..2d029065
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR066/valid.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "last_name": { "type": "string" },
+ "_links": { "type": "object" },
+ "_embedded": { "type": "object" },
+ "@context": { "type": "string" },
+ "@type": { "type": "string" },
+ "@id": { "type": "string" },
+ "x-internal": { "type": "boolean" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_name": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR066/valid.yaml b/src/test/resources/checks/v32/format/OAR066/valid.yaml
new file mode 100644
index 00000000..96b29c72
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR066/valid.yaml
@@ -0,0 +1,37 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ last_name:
+ type: string
+ _links:
+ type: object
+ _embedded:
+ type: object
+ "@context":
+ type: string
+ "@type":
+ type: string
+ "@id":
+ type: string
+ x-internal:
+ type: boolean
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR067/camel-case-error.json b/src/test/resources/checks/v32/format/OAR067/camel-case-error.json
new file mode 100644
index 00000000..8d03aea9
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR067/camel-case-error.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "first_name": { "type": "string" }, # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ "lastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_id": { "type": "integer" }, # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ "userName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR067/camel-case-error.yaml b/src/test/resources/checks/v32/format/OAR067/camel-case-error.yaml
new file mode 100644
index 00000000..2c5a399c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR067/camel-case-error.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ first_name: # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ type: string
+ lastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_id: # Noncompliant {{OAR067: RequestBody and Responses schema property names must be compliant with the camelCase naming convention}}
+ type: integer
+ userName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR067/valid.json b/src/test/resources/checks/v32/format/OAR067/valid.json
new file mode 100644
index 00000000..91b29b66
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR067/valid.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "lastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "userName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR067/valid.yaml b/src/test/resources/checks/v32/format/OAR067/valid.yaml
new file mode 100644
index 00000000..3f1ecb6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR067/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ lastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ userName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR068/externalref.yaml b/src/test/resources/checks/v32/format/OAR068/externalref.yaml
new file mode 100644
index 00000000..fa8fd5a1
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR068/externalref.yaml
@@ -0,0 +1,62 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ $ref: >-
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR068.yaml#/components/schemas/datosUsuario
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ $ref: >-
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/ErrorMessage
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR068/pascal-case-error.json b/src/test/resources/checks/v32/format/OAR068/pascal-case-error.json
new file mode 100644
index 00000000..a7044352
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR068/pascal-case-error.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "first_name": { "type": "string" }, # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "user_id": { "type": "integer" }, # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ "UserName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR068/pascal-case-error.yaml b/src/test/resources/checks/v32/format/OAR068/pascal-case-error.yaml
new file mode 100644
index 00000000..daa457aa
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR068/pascal-case-error.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ first_name: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ type: string
+ LastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ user_Id: # Noncompliant {{OAR068: RequestBody and Responses schema property names must be compliant with the PascalCase naming convention}}
+ type: integer
+ UserName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR068/valid.json b/src/test/resources/checks/v32/format/OAR068/valid.json
new file mode 100644
index 00000000..b8103285
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR068/valid.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/user": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "LastName": { "type": "string" }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "Success",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "UserName": { "type": "string" }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR068/valid.yaml b/src/test/resources/checks/v32/format/OAR068/valid.yaml
new file mode 100644
index 00000000..afbc1cba
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR068/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /user:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ LastName:
+ type: string
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ UserName:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.json b/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.json
new file mode 100644
index 00000000..f5c68809
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "API que cumple"
+ },
+ "paths": {
+ "/usuarios": {
+ "get": {
+ "parameters": [
+ {
+ "name": "username",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "userFirstName", # Noncompliant {{OAR077: All parameters in query must be snake_case}}
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.yaml b/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.yaml
new file mode 100644
index 00000000..25a7d9a9
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR077/not-valid-in-query.yaml
@@ -0,0 +1,19 @@
+ openapi: "3.2.0"
+ info:
+ version: "1.0.0"
+ title: "API que cumple"
+ paths:
+ /usuarios:
+ get:
+ parameters:
+ - name: username
+ in: query
+ schema:
+ type: string
+ - name: userFirstName # Noncompliant {{OAR077: All parameters in query must be snake_case}}
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR077/valid-in-query.json b/src/test/resources/checks/v32/format/OAR077/valid-in-query.json
new file mode 100644
index 00000000..a887b7ca
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR077/valid-in-query.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "API que cumple"
+ },
+ "paths": {
+ "/usuarios": {
+ "get": {
+ "parameters": [
+ {
+ "name": "username",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "user_first_name",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR077/valid-in-query.yaml b/src/test/resources/checks/v32/format/OAR077/valid-in-query.yaml
new file mode 100644
index 00000000..e23c77c4
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR077/valid-in-query.yaml
@@ -0,0 +1,19 @@
+ openapi: "3.2.0"
+ info:
+ version: "1.0.0"
+ title: "API que cumple"
+ paths:
+ /usuarios:
+ get:
+ parameters:
+ - name: username
+ in: query
+ schema:
+ type: string
+ - name: hola_hola
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR086/external-refexample.yaml b/src/test/resources/checks/v32/format/OAR086/external-refexample.yaml
new file mode 100644
index 00000000..812162a6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/external-refexample.yaml
@@ -0,0 +1,62 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/datosUsuario
+ '400':
+ description: Bad Request.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >- # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ https://raw.githubusercontent.com/apiaddicts/sonaropenapi-rules/refs/heads/master/src/test/resources/externalRef/OAR086.yaml#/components/schemas/ErrorMessage
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR086/internal-refexample.yaml b/src/test/resources/checks/v32/format/OAR086/internal-refexample.yaml
new file mode 100644
index 00000000..869b12c6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/internal-refexample.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios.
+ description: Método que permite obtener un listado con datos básicos de un usuario.
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: Listado de suberrores usado para dar información más detallada,
+ como en el caso de errores de validación.
diff --git a/src/test/resources/checks/v32/format/OAR086/invalid-example.json b/src/test/resources/checks/v32/format/OAR086/invalid-example.json
new file mode 100644
index 00000000..6384577b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/invalid-example.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "esta es la descripción de la API." # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "lista de mascotas.",
+ "description": "", # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ "parameters": [
+ {
+ "name": "desde",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "describe init time" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ },
+ {
+ "name": "hasta",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "descibe parameter" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "una lista de mascotas." # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota" # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR086/invalid-example.yaml b/src/test/resources/checks/v32/format/OAR086/invalid-example.yaml
new file mode 100644
index 00000000..4b98ce79
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/invalid-example.yaml
@@ -0,0 +1,41 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+
+paths:
+ /pets:
+ get:
+ summary: lista de mascotas.
+ description: esta ruta devuelve una lista de mascotas # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: describe init time # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: descibe parameter # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+ responses:
+ '200':
+ description: Una lista de mascotas # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota # Noncompliant {{OAR086: Descriptions must begin with a capital letter, end with a period and not be empty}}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR086/valid-example.json b/src/test/resources/checks/v32/format/OAR086/valid-example.json
new file mode 100644
index 00000000..c103ae8b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/valid-example.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API."
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas.",
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "parameters": [
+ {
+ "name": "desde",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "Especifica el parámetro."
+ },
+ {
+ "name": "hasta",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "date"
+ },
+ "required": false,
+ "description": "Especifica el parámetro."
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota."
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR086/valid-example.yaml b/src/test/resources/checks/v32/format/OAR086/valid-example.yaml
new file mode 100644
index 00000000..504d7b60
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR086/valid-example.yaml
@@ -0,0 +1,69 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ description: API de ejemplo para pruebas.
+ contact:
+ name: Nombre del Contacto.
+ email: contact@mail.com
+ version: 1.0.12
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios.
+ description: Método que permite obtener un listado con datos básicos de un usuario.
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: Especifica el parámetro.
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ description: Especifica el parámetro.
+ responses:
+ '200':
+ description: OK.
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción.
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: Listado de suberrores usado para dar información más detallada,
+ como en el caso de errores de validación.
diff --git a/src/test/resources/checks/v32/format/OAR087/invalid-example.json b/src/test/resources/checks/v32/format/OAR087/invalid-example.json
new file mode 100644
index 00000000..6832ca85
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR087/invalid-example.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API.",
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas", # Noncompliant {{OAR087: Summaries must begin with a capital letter, end with a period and not be empty}}
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas retornada con éxito."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota.",
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR087/invalid-example.yaml b/src/test/resources/checks/v32/format/OAR087/invalid-example.yaml
new file mode 100644
index 00000000..a0d5e7b0
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR087/invalid-example.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API.
+
+paths:
+ /pets:
+ get:
+ summary: lista de mascotas. # Noncompliant {{OAR087: Summaries must begin with a capital letter, end with a period and not be empty}}
+ description: Esta ruta devuelve una lista de mascotas.
+ responses:
+ '200':
+ description: Una lista de mascotas retornada con éxito.
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota.
diff --git a/src/test/resources/checks/v32/format/OAR087/valid-example.json b/src/test/resources/checks/v32/format/OAR087/valid-example.json
new file mode 100644
index 00000000..e9b8abd6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR087/valid-example.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0",
+ "description": "Esta es la descripción de la API.",
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Lista de mascotas.",
+ "description": "Esta ruta devuelve una lista de mascotas.",
+ "responses": {
+ "200": {
+ "description": "Una lista de mascotas retornada con éxito."
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Pet": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ }
+ },
+ "description": "Representa una mascota.",
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR087/valid-example.yaml b/src/test/resources/checks/v32/format/OAR087/valid-example.yaml
new file mode 100644
index 00000000..3c9fb947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR087/valid-example.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+ description: Esta es la descripción de la API.
+
+paths:
+ /pets:
+ get:
+ summary: Lista de mascotas.
+ description: Esta ruta devuelve una lista de mascotas.
+ responses:
+ '200':
+ description: Una lista de mascotas retornada con éxito.
+
+components:
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ description: Representa una mascota.
diff --git a/src/test/resources/checks/v32/format/OAR088/invalid-ref.json b/src/test/resources/checks/v32/format/OAR088/invalid-ref.json
new file mode 100644
index 00000000..5182f1a3
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR088/invalid-ref.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0"
+ },
+ "paths": {
+ "/mascotas": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/idMascotaRef" # Noncompliant {{OAR088: The $ref of a parameter must end with the suffix Param}}
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Lista de mascotas"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "idMascotaRef": {
+ "name": "idMascota",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR088/invalid-ref.yaml b/src/test/resources/checks/v32/format/OAR088/invalid-ref.yaml
new file mode 100644
index 00000000..27b0a708
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR088/invalid-ref.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ title: API de ejemplo
+ version: "1.0"
+paths:
+ /mascotas:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/idMascotaRef' # Noncompliant {{OAR088: The $ref of a parameter must end with the suffix Param}}
+ responses:
+ '200':
+ description: Lista de mascotas
+components:
+ parameters:
+ idMascotaRef:
+ name: idMascota
+ in: query
+ required: true
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR088/valid-ref.json b/src/test/resources/checks/v32/format/OAR088/valid-ref.json
new file mode 100644
index 00000000..3043f61b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR088/valid-ref.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0"
+ },
+ "paths": {
+ "/mascotas": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/idMascotaParam"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Lista de mascotas"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "idMascotaParam": {
+ "name": "idMascota",
+ "in": "query",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR088/valid-ref.yaml b/src/test/resources/checks/v32/format/OAR088/valid-ref.yaml
new file mode 100644
index 00000000..56f31b68
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR088/valid-ref.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ title: API de ejemplo
+ version: "1.0"
+paths:
+ /mascotas:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/idMascotaParam'
+ responses:
+ '200':
+ description: Lista de mascotas
+components:
+ parameters:
+ idMascotaParam:
+ name: idMascota
+ in: query
+ required: true
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR089/invalid-ref.json b/src/test/resources/checks/v32/format/OAR089/invalid-ref.json
new file mode 100644
index 00000000..f0cdf3eb
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR089/invalid-ref.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API Sample",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "name": "petId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ },
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetDetailsIncorrect" # Noncompliant {{OAR089: The $ref of a request body must end with the suffix Body}}
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "PetDetailsIncorrect": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR089/invalid-ref.yaml b/src/test/resources/checks/v32/format/OAR089/invalid-ref.yaml
new file mode 100644
index 00000000..e02672f1
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR089/invalid-ref.yaml
@@ -0,0 +1,28 @@
+openapi: '3.2.0'
+info:
+ title: API Sample
+ version: '1.0.0'
+paths:
+ /pets:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Successful response
+ requestBody:
+ $ref: '#/components/requestBodies/PetDetailsIncorrect' # Noncompliant {{OAR089: The $ref of a request body must end with the suffix Body}}
+components:
+ requestBodies:
+ PetDetailsIncorrect:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR089/valid-ref.json b/src/test/resources/checks/v32/format/OAR089/valid-ref.json
new file mode 100644
index 00000000..53176b27
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR089/valid-ref.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API Sample",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "name": "petId",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ },
+ "requestBody": {
+ "$ref": "#/components/requestBodies/PetDetailsBody"
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "PetDetailsBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR089/valid-ref.yaml b/src/test/resources/checks/v32/format/OAR089/valid-ref.yaml
new file mode 100644
index 00000000..ea91c96b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR089/valid-ref.yaml
@@ -0,0 +1,28 @@
+openapi: '3.2.0'
+info:
+ title: API Sample
+ version: '1.0.0'
+paths:
+ /pets:
+ get:
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Successful response
+ requestBody:
+ $ref: '#/components/requestBodies/PetDetailsBody'
+components:
+ requestBodies:
+ PetDetailsBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR090/invalid-ref.json b/src/test/resources/checks/v32/format/OAR090/invalid-ref.json
new file mode 100644
index 00000000..157bd9ba
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR090/invalid-ref.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/InvalidRef" # Noncompliant {{OAR090: The $ref of a response must end with the suffix Response}}
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "InvalidRef": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR090/invalid-ref.yaml b/src/test/resources/checks/v32/format/OAR090/invalid-ref.yaml
new file mode 100644
index 00000000..988e30e4
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR090/invalid-ref.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/InvalidRef' # Noncompliant {{OAR090: The $ref of a response must end with the suffix Response}}
+components:
+ responses:
+ InvalidRef:
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR090/valid-ref.json b/src/test/resources/checks/v32/format/OAR090/valid-ref.json
new file mode 100644
index 00000000..befd45c0
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR090/valid-ref.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/SuccessResponse"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "SuccessResponse": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR090/valid-ref.yaml b/src/test/resources/checks/v32/format/OAR090/valid-ref.yaml
new file mode 100644
index 00000000..d69d7bf7
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR090/valid-ref.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/SuccessResponse'
+components:
+ responses:
+ SuccessResponse:
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR097/too-short.json b/src/test/resources/checks/v32/format/OAR097/too-short.json
new file mode 100644
index 00000000..e843f4a8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR097/too-short.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros" # Noncompliant {{OAR097: Path has to few parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR097/too-short.yaml b/src/test/resources/checks/v32/format/OAR097/too-short.yaml
new file mode 100644
index 00000000..8a0eefd6
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR097/too-short.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros # Noncompliant {{OAR097: Path has to few parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR097/valid.json b/src/test/resources/checks/v32/format/OAR097/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR097/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR097/valid.yaml b/src/test/resources/checks/v32/format/OAR097/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR097/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR098/too-long.json b/src/test/resources/checks/v32/format/OAR098/too-long.json
new file mode 100644
index 00000000..ae50a57c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR098/too-long.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1/vida" # Noncompliant {{OAR098: Path has to many parts}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR098/too-long.yaml b/src/test/resources/checks/v32/format/OAR098/too-long.yaml
new file mode 100644
index 00000000..27153a6b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR098/too-long.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1/vida # Noncompliant {{OAR098: Path has to many parts}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR098/valid.json b/src/test/resources/checks/v32/format/OAR098/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR098/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR098/valid.yaml b/src/test/resources/checks/v32/format/OAR098/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR098/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR099/valid.json b/src/test/resources/checks/v32/format/OAR099/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR099/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR099/valid.yaml b/src/test/resources/checks/v32/format/OAR099/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR099/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR099/without-api-prefix.json b/src/test/resources/checks/v32/format/OAR099/without-api-prefix.json
new file mode 100644
index 00000000..fef3e1f3
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR099/without-api-prefix.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/seguros/v1" # Noncompliant {{OAR099: API name must start with prefix 'api-'}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR099/without-api-prefix.yaml b/src/test/resources/checks/v32/format/OAR099/without-api-prefix.yaml
new file mode 100644
index 00000000..8566af68
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR099/without-api-prefix.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/seguros/v1 # Noncompliant {{OAR099: API name must start with prefix 'api-'}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR100/incorrect-version.json b/src/test/resources/checks/v32/format/OAR100/incorrect-version.json
new file mode 100644
index 00000000..9b1a1964
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR100/incorrect-version.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1.0" # Noncompliant {{OAR100: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+ }
+ ],
+ "paths" : { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR100/incorrect-version.yaml b/src/test/resources/checks/v32/format/OAR100/incorrect-version.yaml
new file mode 100644
index 00000000..b48f6138
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR100/incorrect-version.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1.0 # Noncompliant {{OAR100: Last path part must be the API version, indicated with the prefix 'v' and the version number as integer}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR100/valid.json b/src/test/resources/checks/v32/format/OAR100/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR100/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR100/valid.yaml b/src/test/resources/checks/v32/format/OAR100/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR100/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/empty-path.json b/src/test/resources/checks/v32/format/OAR101/empty-path.json
new file mode 100644
index 00000000..51ebd431
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/empty-path.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/empty-path.yaml b/src/test/resources/checks/v32/format/OAR101/empty-path.yaml
new file mode 100644
index 00000000..941d6abf
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/empty-path.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/invalid.json b/src/test/resources/checks/v32/format/OAR101/invalid.json
new file mode 100644
index 00000000..8cb6efa5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/invalid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/wrong/v1" # Noncompliant {{OAR101: The first part of the path is not allowed. Allowed values are: wrong}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/invalid.yaml b/src/test/resources/checks/v32/format/OAR101/invalid.yaml
new file mode 100644
index 00000000..3f982cae
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/wrong/v1 # Noncompliant {{OAR101: The first part of the path is not allowed. Allowed values are: wrong}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/valid-with-values.json b/src/test/resources/checks/v32/format/OAR101/valid-with-values.json
new file mode 100644
index 00000000..729bab18
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/valid-with-values.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/valid-with-values.yaml b/src/test/resources/checks/v32/format/OAR101/valid-with-values.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/valid-with-values.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/valid.json b/src/test/resources/checks/v32/format/OAR101/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR101/valid.yaml b/src/test/resources/checks/v32/format/OAR101/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR101/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/invalid.json b/src/test/resources/checks/v32/format/OAR102/invalid.json
new file mode 100644
index 00000000..cf40e75b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/invalid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/wrong" # Noncompliant {{OAR102: The second part of the path is not allowed. Allowed values are: wrong}}
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/invalid.yaml b/src/test/resources/checks/v32/format/OAR102/invalid.yaml
new file mode 100644
index 00000000..88d34c44
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/wrong # Noncompliant {{OAR102: The second part of the path is not allowed. Allowed values are: wrong}}
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/one-part-path.json b/src/test/resources/checks/v32/format/OAR102/one-part-path.json
new file mode 100644
index 00000000..c9e505e8
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/one-part-path.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/one-part-path.yaml b/src/test/resources/checks/v32/format/OAR102/one-part-path.yaml
new file mode 100644
index 00000000..ba1fcf71
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/one-part-path.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/valid-with-values.json b/src/test/resources/checks/v32/format/OAR102/valid-with-values.json
new file mode 100644
index 00000000..729bab18
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/valid-with-values.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/valid-with-values.yaml b/src/test/resources/checks/v32/format/OAR102/valid-with-values.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/valid-with-values.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/valid.json b/src/test/resources/checks/v32/format/OAR102/valid.json
new file mode 100644
index 00000000..5a669947
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/valid.json
@@ -0,0 +1,13 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "http://petstore.swagger.io/api-seguros/v1"
+ }
+ ],
+ "paths": { }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR102/valid.yaml b/src/test/resources/checks/v32/format/OAR102/valid.yaml
new file mode 100644
index 00000000..10318c6a
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR102/valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://petstore.swagger.io/api-seguros/v1
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR110/valid.json b/src/test/resources/checks/v32/format/OAR110/valid.json
new file mode 100644
index 00000000..5e41a801
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR110/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de Ejemplo",
+ "version": "1.0.0",
+ "description": "Esta es una API de ejemplo.",
+ "termsOfService": "http://ejemplo.com/terminos/",
+ "contact": {
+ "name": "Soporte de API",
+ "url": "http://ejemplo.com/contacto",
+ "email": "contacto@ejemplo.com"
+ },
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR110/valid.yaml b/src/test/resources/checks/v32/format/OAR110/valid.yaml
new file mode 100644
index 00000000..a81c6c5b
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR110/valid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ title: API de Ejemplo
+ version: 1.0.0
+ description: Esta es una API de ejemplo.
+ termsOfService: http://ejemplo.com/terminos/
+ contact:
+ name: Soporte de API
+ url: http://ejemplo.com/contacto
+ email: contacto@ejemplo.com
+ license:
+ name: aaa
+ url: awss
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR111/valid.json b/src/test/resources/checks/v32/format/OAR111/valid.json
new file mode 100644
index 00000000..5e41a801
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR111/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de Ejemplo",
+ "version": "1.0.0",
+ "description": "Esta es una API de ejemplo.",
+ "termsOfService": "http://ejemplo.com/terminos/",
+ "contact": {
+ "name": "Soporte de API",
+ "url": "http://ejemplo.com/contacto",
+ "email": "contacto@ejemplo.com"
+ },
+ "license": {
+ "name": "Apache 2.0",
+ "url": "https://www.apache.org/licenses/LICENSE-2.0.html"
+ }
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR111/valid.yaml b/src/test/resources/checks/v32/format/OAR111/valid.yaml
new file mode 100644
index 00000000..821ebee0
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR111/valid.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ title: API de Ejemplo
+ version: 1.0.0
+ description: Esta es una API de ejemplo.
+ termsOfService: http://ejemplo.com/terminos/
+ contact:
+ name: Soporte de API
+ url: http://ejemplo.com/contacto
+ email: contacto@ejemplo.com
+ license:
+ name: Apache 2.0
+ url: https://www.apache.org/licenses/LICENSE-2.0.html
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/format/OAR113/invalid.json b/src/test/resources/checks/v32/format/OAR113/invalid.json
new file mode 100644
index 00000000..f0d896b5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR113/invalid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/example": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "get": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "description": "Get example",
+ "responses": {
+ "200": { # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ "description": "Successful response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExampleObject"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR113/invalid.yaml b/src/test/resources/checks/v32/format/OAR113/invalid.yaml
new file mode 100644
index 00000000..fbbcf36d
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR113/invalid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: "1.0.0"
+ title: "Sample API"
+paths:
+ /example: # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ get: # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ description: "Get example"
+ responses:
+ "200": # Noncompliant {{OAR113: Field or extension x-custom-example must be at the assigned location}}
+ description: "Successful response"
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ExampleObject"
+
diff --git a/src/test/resources/checks/v32/format/OAR113/valid.json b/src/test/resources/checks/v32/format/OAR113/valid.json
new file mode 100644
index 00000000..8b6196fe
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR113/valid.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API",
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "x-custom-example": "example value",
+ "description": "Get example",
+ "responses": {
+ "200": {
+ "x-custom-example": "example value",
+ "description": "Successful response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ExampleObject"
+ }
+ }
+ }
+ }
+ }
+ },
+ "x-custom-example": "example value"
+ }
+ },
+ "components": {
+ "schemas": {
+ "ExampleObject": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR113/valid.yaml b/src/test/resources/checks/v32/format/OAR113/valid.yaml
new file mode 100644
index 00000000..e001ed7c
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR113/valid.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: "1.0.0"
+ title: "Sample API"
+paths:
+ /example:
+ get:
+ x-custom-example: "example"
+ description: "Get example"
+ responses:
+ "200":
+ x-custom-example: "example"
+ description: "Successful response"
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ExampleObject"
+ x-custom-example: "example"
+components:
+ schemas:
+ ExampleObject:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v32/format/OAR115/invalid.json b/src/test/resources/checks/v32/format/OAR115/invalid.json
new file mode 100644
index 00000000..c34c0872
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR115/invalid.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Obtener lista de usuarios",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "400": {
+ "description": "Error de validación",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "code": { "type": "integer" },
+ "message": { "type": "string" }
+ },
+ "required":[
+ "code",
+ "message",
+ "otherfield" # Noncompliant {{OAR115: This value does not exist, it must be defined in the schema properties}}
+ ]
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR115/invalid.yaml b/src/test/resources/checks/v32/format/OAR115/invalid.yaml
new file mode 100644
index 00000000..145f315e
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR115/invalid.yaml
@@ -0,0 +1,30 @@
+openapi: "3.2.0"
+info:
+ title: API de ejemplo
+ version: "1.0.0"
+paths:
+ /users:
+ get:
+ summary: Obtener lista de usuarios
+ responses:
+ '200':
+ description: OK
+ '400':
+ description: Error de validación
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ErrorResponse"
+components:
+ schemas:
+ ErrorResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ required:
+ - code
+ - message
+ - otherfield # Noncompliant {{OAR115: This value does not exist, it must be defined in the schema properties}}
diff --git a/src/test/resources/checks/v32/format/OAR115/valid.json b/src/test/resources/checks/v32/format/OAR115/valid.json
new file mode 100644
index 00000000..aee39dd5
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR115/valid.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API de ejemplo",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Obtener lista de usuarios",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "400": {
+ "description": "Error de validación",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/ErrorResponse"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "ErrorResponse": {
+ "type": "object",
+ "properties": {
+ "code": { "type": "integer" },
+ "message": { "type": "string" }
+ },
+ "required":[
+ "code",
+ "message"
+ ]
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/format/OAR115/valid.yaml b/src/test/resources/checks/v32/format/OAR115/valid.yaml
new file mode 100644
index 00000000..0186f450
--- /dev/null
+++ b/src/test/resources/checks/v32/format/OAR115/valid.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ title: API de ejemplo
+ version: "1.0.0"
+paths:
+ /users:
+ get:
+ summary: Obtener lista de usuarios
+ responses:
+ '200':
+ description: OK
+ '400':
+ description: Error de validación
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/ErrorResponse"
+components:
+ schemas:
+ ErrorResponse:
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ required:
+ - code
+ - message
diff --git a/src/test/resources/checks/v32/operations/OAR008/plain.json b/src/test/resources/checks/v32/operations/OAR008/plain.json
new file mode 100644
index 00000000..132f56e4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR008/plain.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "patch" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "put" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "delete" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "head" : { # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "options" : { # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR008/plain.yaml b/src/test/resources/checks/v32/operations/OAR008/plain.yaml
new file mode 100644
index 00000000..9b363ccb
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR008/plain.yaml
@@ -0,0 +1,34 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ patch:
+ responses:
+ 200:
+ description: Ok
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+ head: # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+ options: # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/operations/OAR013/plain.json b/src/test/resources/checks/v32/operations/OAR013/plain.json
new file mode 100644
index 00000000..f01ecf15
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR013/plain.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : { # Noncompliant {{OAR013: Default response is required}}
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "default" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR013/plain.yaml b/src/test/resources/checks/v32/operations/OAR013/plain.yaml
new file mode 100644
index 00000000..1c93c05c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR013/plain.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR013: Default response is required}}
+ 200:
+ description: Ok
+ post:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR014/plain.json b/src/test/resources/checks/v32/operations/OAR014/plain.json
new file mode 100644
index 00000000..e5976e87
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR014/plain.json
@@ -0,0 +1,54 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR014/plain.yaml b/src/test/resources/checks/v32/operations/OAR014/plain.yaml
new file mode 100644
index 00000000..a5037c89
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR014/plain.yaml
@@ -0,0 +1,30 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR015/plain.json b/src/test/resources/checks/v32/operations/OAR015/plain.json
new file mode 100644
index 00000000..97cb52fe
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR015/plain.json
@@ -0,0 +1,72 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six/seven": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR015/plain.yaml b/src/test/resources/checks/v32/operations/OAR015/plain.yaml
new file mode 100644
index 00000000..f29ada81
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR015/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six/seven: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR017/plain.json b/src/test/resources/checks/v32/operations/OAR017/plain.json
new file mode 100644
index 00000000..ee93ff2b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR017/plain.json
@@ -0,0 +1,49 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/{one}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/two" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/me" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/me/three" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}/three" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/one/{two}/{three}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ },
+ "/me/items/{id}" : {
+ "get" : {
+ "responses" : { "200" : { "description" : "Ok" } }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR017/plain.yaml b/src/test/resources/checks/v32/operations/OAR017/plain.yaml
new file mode 100644
index 00000000..a623de5e
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR017/plain.yaml
@@ -0,0 +1,45 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/me/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/operations/OAR018/plain.json b/src/test/resources/checks/v32/operations/OAR018/plain.json
new file mode 100644
index 00000000..470ce80b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR018/plain.json
@@ -0,0 +1,194 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR018/plain.yaml b/src/test/resources/checks/v32/operations/OAR018/plain.yaml
new file mode 100644
index 00000000..aed8616a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR018/plain.yaml
@@ -0,0 +1,114 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /resources:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}}}
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ patch:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+
+ /resources/get:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/get}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/delete:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}/other:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/no-post.json b/src/test/resources/checks/v32/operations/OAR027/no-post.json
new file mode 100644
index 00000000..b0d8cd88
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/no-post.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "201" : {
+ "description" : "Found"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/no-post.yaml b/src/test/resources/checks/v32/operations/OAR027/no-post.yaml
new file mode 100644
index 00000000..430d9384
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/no-post.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 201:
+ description: Found
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.json b/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.json
new file mode 100644
index 00000000..d0a66815
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : {
+ "Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.yaml b/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.yaml
new file mode 100644
index 00000000..8a83e03c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-with-location.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers:
+ Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.json b/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.json
new file mode 100644
index 00000000..c8fd6785
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "X-Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.yaml b/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.yaml
new file mode 100644
index 00000000..74e0450a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-with-other-headers.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ X-Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.json b/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.json
new file mode 100644
index 00000000..d5c533f8
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "description" : "Created"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.yaml b/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.yaml
new file mode 100644
index 00000000..4b5ba620
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-201-without-location.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ description: Created
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-no-201.json b/src/test/resources/checks/v32/operations/OAR027/post-no-201.json
new file mode 100644
index 00000000..af7a2bf5
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-no-201.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR027/post-no-201.yaml b/src/test/resources/checks/v32/operations/OAR027/post-no-201.yaml
new file mode 100644
index 00000000..89cbdd7a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR027/post-no-201.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 200:
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/valid.json b/src/test/resources/checks/v32/operations/OAR030/valid.json
new file mode 100644
index 00000000..9fb64210
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/valid.yaml b/src/test/resources/checks/v32/operations/OAR030/valid.yaml
new file mode 100644
index 00000000..b084d2f4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.json b/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.json
new file mode 100644
index 00000000..de85e0af
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : { # Noncompliant {{OAR030: Method get must be declared}}
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.yaml b/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.yaml
new file mode 100644
index 00000000..c5b262df
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/with-status-without-get.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status: # Noncompliant {{OAR030: Method get must be declared}}
+ post:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/without-status.json b/src/test/resources/checks/v32/operations/OAR030/without-status.json
new file mode 100644
index 00000000..15d69e15
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/without-status.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : { # Noncompliant {{OAR030: The path '/status' must be declared}}
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR030/without-status.yaml b/src/test/resources/checks/v32/operations/OAR030/without-status.yaml
new file mode 100644
index 00000000..1c969a70
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR030/without-status.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths: # Noncompliant {{OAR030: The path '/status' must be declared}}
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR032/forbidden-names.json b/src/test/resources/checks/v32/operations/OAR032/forbidden-names.json
new file mode 100644
index 00000000..e0a00540
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR032/forbidden-names.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/elements" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/a/nested/items" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/another/{param}/with/valores" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR032/forbidden-names.yaml b/src/test/resources/checks/v32/operations/OAR032/forbidden-names.yaml
new file mode 100644
index 00000000..babefe4b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR032/forbidden-names.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /elements: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /a/nested/items: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /another/{param}/with/valores: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR032/valid.json b/src/test/resources/checks/v32/operations/OAR032/valid.json
new file mode 100644
index 00000000..6360b965
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR032/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{elements}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR032/valid.yaml b/src/test/resources/checks/v32/operations/OAR032/valid.yaml
new file mode 100644
index 00000000..2b13ba92
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR032/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{elements}:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.json b/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.json
new file mode 100644
index 00000000..12fc95b7
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.json
@@ -0,0 +1,48 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ },
+ "name" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.yaml b/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.yaml
new file mode 100644
index 00000000..d5abbc7b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-multiple-properties.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-one-property.json b/src/test/resources/checks/v32/operations/OAR038/valid-one-property.json
new file mode 100644
index 00000000..2962b123
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-one-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-one-property.yaml b/src/test/resources/checks/v32/operations/OAR038/valid-one-property.yaml
new file mode 100644
index 00000000..64779efd
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-one-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-with-error.json b/src/test/resources/checks/v32/operations/OAR038/valid-with-error.json
new file mode 100644
index 00000000..c0c4fc97
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-with-error.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "error" : {
+ "type" : "object",
+ "properties" : {
+ "message" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR038/valid-with-error.yaml b/src/test/resources/checks/v32/operations/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..9aaaed7e
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.json b/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..c0247b83
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..f46de733
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.json b/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.json
new file mode 100644
index 00000000..d8e8fe72
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type" : "object",
+ "properties" : { }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.yaml b/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.yaml
new file mode 100644
index 00000000..853cc923
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/with-properties-empty.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+ properties: {}
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-data.json b/src/test/resources/checks/v32/operations/OAR038/without-data.json
new file mode 100644
index 00000000..bc4b778d
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-data.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-data.yaml b/src/test/resources/checks/v32/operations/OAR038/without-data.yaml
new file mode 100644
index 00000000..910af91c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-data.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-properties.json b/src/test/resources/checks/v32/operations/OAR038/without-properties.json
new file mode 100644
index 00000000..821d557a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-properties.json
@@ -0,0 +1,53 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "post": {
+ "responses": {
+ "201": {
+ "$ref": "#/components/responses/createResponse"
+ },
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/post_response"
+ }
+ ]
+ },
+ "post_response": {
+ "type": "object",
+ "properties": {
+ "data": { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type": "object"
+ }
+ }
+ }
+ },
+ "responses": {
+ "createResponse": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-properties.yaml b/src/test/resources/checks/v32/operations/OAR038/without-properties.yaml
new file mode 100644
index 00000000..ab65b6ae
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-properties.yaml
@@ -0,0 +1,33 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ $ref: '#/components/responses/createResponse'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/post_response'
+
+ post_response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+
+ responses:
+ createResponse:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-schema.json b/src/test/resources/checks/v32/operations/OAR038/without-schema.json
new file mode 100644
index 00000000..4e661996
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-schema.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR038: Response schema is required}}
+ "description" : "Ok"
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR038/without-schema.yaml b/src/test/resources/checks/v32/operations/OAR038/without-schema.yaml
new file mode 100644
index 00000000..6d2d9070
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR038/without-schema.yaml
@@ -0,0 +1,12 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR038: Response schema is required}}
+ description: Ok
+ 204:
+ description: No content
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR039/missing-codes.json b/src/test/resources/checks/v32/operations/OAR039/missing-codes.json
new file mode 100644
index 00000000..0a97606f
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR039/missing-codes.json
@@ -0,0 +1,109 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "put": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "patch": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "delete": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR039/missing-codes.yaml b/src/test/resources/checks/v32/operations/OAR039/missing-codes.yaml
new file mode 100644
index 00000000..a3761ff4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR039/missing-codes.yaml
@@ -0,0 +1,68 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ put:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ patch:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ delete:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR039/valid.json b/src/test/resources/checks/v32/operations/OAR039/valid.json
new file mode 100644
index 00000000..e0abd6e0
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR039/valid.json
@@ -0,0 +1,283 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Partial collection"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR039/valid.yaml b/src/test/resources/checks/v32/operations/OAR039/valid.yaml
new file mode 100644
index 00000000..6d1fc278
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR039/valid.yaml
@@ -0,0 +1,184 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Partial collection
+ 400:
+ description: Bad request
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ put:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ patch:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ delete:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner:
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR045/defined-response.json b/src/test/resources/checks/v32/operations/OAR045/defined-response.json
new file mode 100644
index 00000000..b19ef64b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR045/defined-response.yaml b/src/test/resources/checks/v32/operations/OAR045/defined-response.yaml
new file mode 100644
index 00000000..14f08cea
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v32/operations/OAR046/declared-tag.json b/src/test/resources/checks/v32/operations/OAR046/declared-tag.json
new file mode 100644
index 00000000..e21e1581
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR046/declared-tag.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "tags" : [ {
+ "name" : "used-tag",
+ "description" : "a tag referenced in the operations"
+ } ],
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "tags" : [ "used-tag" ],
+ "responses" : { }
+ },
+ "post" : { # Noncompliant {{OAR046: Associate a tag to this operation}}
+ "responses" : {
+ "default" : {
+ "description" : "the default response"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR046/declared-tag.yaml b/src/test/resources/checks/v32/operations/OAR046/declared-tag.yaml
new file mode 100644
index 00000000..060d6d42
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR046/declared-tag.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+tags:
+- name: used-tag
+ description: a tag referenced in the operations
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ tags:
+ - used-tag
+ responses: {}
+ post: # Noncompliant {{OAR046: Associate a tag to this operation}}
+ responses:
+ default:
+ description: the default response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR048/many-body-params.json b/src/test/resources/checks/v32/operations/OAR048/many-body-params.json
new file mode 100644
index 00000000..ddfcfed1
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR048/many-body-params.json
@@ -0,0 +1,75 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "responses": {
+ "default": {
+ "description": "the default response"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR048: An operation can have at most one body parameter}}
+ "requestBody": {
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "otherParam": {
+ "type": "string"
+ }
+ },
+ "required": ["otherParam"]
+ }
+ }
+ }
+ },
+ "x-extraRequestBody": {
+ "description": "Simulated second body param (invalid by spec)",
+ "required": true,
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "toto": {
+ "type": "string"
+ }
+ },
+ "required": ["toto"]
+ }
+ }
+ }
+ },
+ "responses": {
+ "default": {
+ "description": "the default response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "Used": {
+ "type": "string"
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/operations/OAR048/many-body-params.yaml b/src/test/resources/checks/v32/operations/OAR048/many-body-params.yaml
new file mode 100644
index 00000000..b4c8f96f
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR048/many-body-params.yaml
@@ -0,0 +1,47 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: string
+ responses:
+ default:
+ description: the default response
+ post: # Noncompliant {{OAR048: An operation can have at most one body parameter}}
+ requestBody:
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ otherParam:
+ type: string
+ required:
+ - otherParam
+ x-extraRequestBody:
+ description: Simulated second body param (invalid by spec)
+ required: true
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ toto:
+ type: string
+ required:
+ - toto
+ responses:
+ default:
+ description: the default response
+components:
+ schemas:
+ Used:
+ type: string
diff --git a/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.json b/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.json
new file mode 100644
index 00000000..07442dcb
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "get": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR061: Response code 200, 202, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.yaml b/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.yaml
new file mode 100644
index 00000000..effc2d24
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR061/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ get:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ get:
+ summary: Get all users
+ responses: # Noncompliant {{OAR061: Response code 200, 202, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR061/valid.json b/src/test/resources/checks/v32/operations/OAR061/valid.json
new file mode 100644
index 00000000..8c8e535c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR061/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR061/valid.yaml b/src/test/resources/checks/v32/operations/OAR061/valid.yaml
new file mode 100644
index 00000000..23e12b7f
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR061/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ get:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.json b/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.json
new file mode 100644
index 00000000..4a8b66f7
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "post": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "post": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "post": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR062: Response code 200, 201, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.yaml b/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.yaml
new file mode 100644
index 00000000..15a14c02
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR062/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ post:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ post:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ post:
+ summary: Get all users
+ responses: # Noncompliant {{OAR062: Response code 200, 201, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR062/valid.json b/src/test/resources/checks/v32/operations/OAR062/valid.json
new file mode 100644
index 00000000..01d3812d
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR062/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "post": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "post": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR062/valid.yaml b/src/test/resources/checks/v32/operations/OAR062/valid.yaml
new file mode 100644
index 00000000..d8da0633
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR062/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ post:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ post:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.json b/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.json
new file mode 100644
index 00000000..81d5591a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "put": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "put": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "put": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR063: Response code 200, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.yaml b/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.yaml
new file mode 100644
index 00000000..32c26e08
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR063/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ put:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ put:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ put:
+ summary: Get all users
+ responses: # Noncompliant {{OAR063: Response code 200, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR063/valid.json b/src/test/resources/checks/v32/operations/OAR063/valid.json
new file mode 100644
index 00000000..2a09b682
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR063/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "put": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "put": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR063/valid.yaml b/src/test/resources/checks/v32/operations/OAR063/valid.yaml
new file mode 100644
index 00000000..cc9f6184
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR063/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ put:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ put:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.json b/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.json
new file mode 100644
index 00000000..d7afbde4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "patch": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "patch": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "patch": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR064: Response code 200, 202, 204, 206 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.yaml b/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.yaml
new file mode 100644
index 00000000..e77f9cc4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR064/insuficent-response-codes.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ patch:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ patch:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ patch:
+ summary: Get all users
+ responses: # Noncompliant {{OAR064: Response code 200, 202, 204, 206 must be defined}}
+ 400:
+ description: Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR064/valid.json b/src/test/resources/checks/v32/operations/OAR064/valid.json
new file mode 100644
index 00000000..e7c7a959
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR064/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "patch": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "patch": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR064/valid.yaml b/src/test/resources/checks/v32/operations/OAR064/valid.yaml
new file mode 100644
index 00000000..8a9e567c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR064/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ patch:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ patch:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.json b/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.json
new file mode 100644
index 00000000..dfaec82b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "delete": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR065: Response code 200, 202, 204 must be defined}}
+ "400": {
+ "description": "Error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.yaml b/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.yaml
new file mode 100644
index 00000000..2e53a412
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR065/insuficent-response-codes.yaml
@@ -0,0 +1,24 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ 400:
+ description: error
+ /another:
+ delete:
+ summary: Get another API status
+ responses:
+ 400:
+ description: error
+ /users:
+ delete:
+ summary: Get all users
+ responses: # Noncompliant {{OAR065: Response code 200, 202, 204 must be defined}}
+ 400:
+ description: Error
+
diff --git a/src/test/resources/checks/v32/operations/OAR065/valid.json b/src/test/resources/checks/v32/operations/OAR065/valid.json
new file mode 100644
index 00000000..e369b083
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR065/valid.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ },
+ "202": {
+ "description": "Accepted"
+ },
+ "206": {
+ "description": "Partial Content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR065/valid.yaml b/src/test/resources/checks/v32/operations/OAR065/valid.yaml
new file mode 100644
index 00000000..d725e721
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR065/valid.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
+ /users:
+ delete:
+ summary: Get all users
+ responses:
+ 200:
+ description: OK
+ 202:
+ description: Accepted
+ 206:
+ description: Partial Content
diff --git a/src/test/resources/checks/v32/operations/OAR071/missing-query-params.json b/src/test/resources/checks/v32/operations/OAR071/missing-query-params.json
new file mode 100644
index 00000000..bfab69a1
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR071/missing-query-params.json
@@ -0,0 +1,59 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [ # Noncompliant {{OAR071: Query parameters param3 must be defined}}
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "param4",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param5",
+ "in": "query",
+ "schema": {
+ "type": "number"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR071/missing-query-params.yaml b/src/test/resources/checks/v32/operations/OAR071/missing-query-params.yaml
new file mode 100644
index 00000000..b08e69cb
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR071/missing-query-params.yaml
@@ -0,0 +1,34 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters: # Noncompliant {{OAR071: Query parameters param3 must be defined}}
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ - name: param4
+ in: query
+ schema:
+ type: string
+ - name: param5
+ in: query
+ schema:
+ type: number
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR071/valid-query-params.json b/src/test/resources/checks/v32/operations/OAR071/valid-query-params.json
new file mode 100644
index 00000000..0f950a0d
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR071/valid-query-params.json
@@ -0,0 +1,66 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "param3",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "name": "param4",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param5",
+ "in": "query",
+ "schema": {
+ "type": "number"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR071/valid-query-params.yaml b/src/test/resources/checks/v32/operations/OAR071/valid-query-params.yaml
new file mode 100644
index 00000000..94082031
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR071/valid-query-params.yaml
@@ -0,0 +1,38 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ - name: param4
+ in: query
+ schema:
+ type: string
+ - name: param5
+ in: query
+ schema:
+ type: number
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR091/no-ref.json b/src/test/resources/checks/v32/operations/OAR091/no-ref.json
new file mode 100644
index 00000000..e88f4af5
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR091/no-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "parameters": [ # Noncompliant {{OAR091: Parameters must contain only references ($ref)}}
+ {
+ "name": "user",
+ "in": "query",
+ "description": "User information",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR091/no-ref.yaml b/src/test/resources/checks/v32/operations/OAR091/no-ref.yaml
new file mode 100644
index 00000000..2634ee99
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR091/no-ref.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ parameters: # Noncompliant {{OAR091: Parameters must contain only references ($ref)}}
+ - name: user
+ in: query
+ description: User information
+ required: true
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
+ responses:
+ '200':
+ description: Successful response
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR091/with-ref.json b/src/test/resources/checks/v32/operations/OAR091/with-ref.json
new file mode 100644
index 00000000..17cfa3a8
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR091/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/UserParam"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Successful response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "UserParam": {
+ "name": "user",
+ "in": "query",
+ "description": "User information",
+ "required": true,
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR091/with-ref.yaml b/src/test/resources/checks/v32/operations/OAR091/with-ref.yaml
new file mode 100644
index 00000000..5c53e897
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR091/with-ref.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/UserParam'
+ responses:
+ '200':
+ description: Successful response
+components:
+ parameters:
+ UserParam:
+ name: user
+ in: query
+ description: User information
+ required: true
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR092/no-ref.json b/src/test/resources/checks/v32/operations/OAR092/no-ref.json
new file mode 100644
index 00000000..eb58d8e6
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR092/no-ref.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "summary": "Create a pet",
+ "requestBody": { # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ "description": "The pet to create",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet created successfully",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR092/no-ref.yaml b/src/test/resources/checks/v32/operations/OAR092/no-ref.yaml
new file mode 100644
index 00000000..00d4b47b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR092/no-ref.yaml
@@ -0,0 +1,579 @@
+openapi: "3.2.0"
+info:
+ title: Sample-API_efc2b9f76813_V
+ description: API de ejemplo para pruebas
+ contact:
+ name: Nombre del Contacto
+ email: contact@mail.com
+ version: 1.0.0
+servers:
+ - url: https://api.example.es/api-sample/v1
+paths:
+ /datos-usuarios:
+ get:
+ summary: Listado de usuarios
+ description: Método que permite obtener un listado con datos básicos de un usuario
+ parameters:
+ - name: desde
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ - name: hasta
+ in: query
+ schema:
+ type: string
+ format: date
+ required: false
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: desde
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '500'
+ message: Internal server error
+ path: /datos-usuario
+ type: https://docs.example.es/x/5008Aw
+ operationId: '10004'
+ errors:
+ - code: '501'
+ message: Internal server error
+ post:
+ summary: Alta de los datos de un usuario
+ description: Método que permite dar de alta los datos básicos de un usuario
+ requestBody: # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ description: Datos del usuario
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ responses:
+ '201':
+ description: OK
+ headers:
+ location:
+ description: RFC 7231 - The new resource which was created by the request.
+ schema:
+ type: string
+ example: /datos-usuarios/a2649c29-48c6-4c48-b64d-0455346efbbd
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10004'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: emailUsuario
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '500'
+ message: Internal server error
+ path: /datos-usuario
+ type: https://docs.example.es/x/5008Aw
+ operationId: '10004'
+ errors:
+ - code: '501'
+ message: Internal server error
+ x-codegen-request-body-name: body
+ /datos-usuarios/{idUsuario}:
+ get:
+ summary: Recuperación de los datos de un usuario por su id
+ description: >-
+ Método que permite recuperar la información básica de un usuario por su
+ id
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10001'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '404'
+ message: Not found
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10002'
+ errors:
+ - code: '102'
+ message: Entity not found
+ location: idUsuario
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ put:
+ summary: Modificación de los datos de un usuario
+ description: Método que permite modificar los datos básicos de un usuario
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ requestBody: # Noncompliant {{OAR092: Request body must contain only references ($ref)}}
+ description: Datos del usuario
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ responses:
+ '200':
+ description: OK
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/datosUsuario'
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10002'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ x-codegen-request-body-name: body
+ delete:
+ summary: Borrado de los datos de un usuario
+ description: Método que permite borrar los datos básicos de un usuario
+ parameters:
+ - name: idUsuario
+ in: path
+ description: Identificador del usuario
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 255
+ format: ^[0-9]*$
+ responses:
+ '204':
+ description: No content
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ '400':
+ description: Bad Request
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '400'
+ message: Bad Request
+ path: /datos-usuario/0
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10003'
+ errors:
+ - code: '101'
+ message: Invalid format
+ location: idUsuario
+ '404':
+ description: Not found (404)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ '429':
+ description: Too many requests
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+ example:
+ error:
+ status: '429'
+ message: Too many requests
+ path: /datos-usuario
+ type: https://docs.example.es/x/A1D8Aw
+ operationId: '10005'
+ errors:
+ - code: '105'
+ message: >-
+ The user has sent too many requests in a given amount of
+ time
+ default:
+ description: Server Error (50X)
+ headers:
+ X-Correlation-Id:
+ description: Cabecera 'X-Correlation-Id'
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorMessage'
+components:
+ schemas:
+ datosUsuario:
+ title: datosUsuario
+ type: object
+ required:
+ - nombreUsuario
+ - emailUsuario
+ properties:
+ idUsuario:
+ type: string
+ description: ID del usuario
+ example: '12'
+ readOnly: true
+ nombreUsuario:
+ type: string
+ description: Nombre del usuario
+ minLength: 5
+ maxLength: 255
+ example: Pedro
+ emailUsuario:
+ type: string
+ description: Email del usuario
+ minLength: 5
+ maxLength: 255
+ example: pedro@mail.com
+ fechaNacimiento:
+ type: string
+ description: Fecha de nacimiento
+ format: date
+ example: 1980-10-11T00:00:00.000Z
+ alta:
+ type: string
+ description: Fecha de alta
+ format: date-time
+ example: 2022-05-10T12:00:27.870Z
+ description: Datos básicos de un usuario
+ errorMessage:
+ required:
+ - message
+ - status
+ type: object
+ properties:
+ status:
+ type: string
+ description: Especifica el status code HTTP al que se traducirá la excepción.
+ message:
+ type: string
+ description: Mensaje descriptivo del error.
+ path:
+ type: string
+ description: URL path de la petición que originó el error.
+ type:
+ type: string
+ description: URL que apunta a una descripción de los códigos de error.
+ operationId:
+ type: string
+ description: Id de negocio de la operación realizada.
+ errors:
+ type: array
+ description: >-
+ Listado de suberrores usado para dar información más detallada, como
+ en el caso de errores de validación.
+ items:
+ $ref: '#/components/schemas/errors'
+ description: Datamodel refleja el formato de respuesta de error
+ errors:
+ required:
+ - message
+ type: object
+ properties:
+ message:
+ type: string
+ description: Detalle del suberror.
+ code:
+ type: string
+ description: Código de error (en errores de validación indica el tipo de error).
+ location:
+ type: string
+ description: >-
+ Localización del error (en errores de validación indica el campo
+ donde se produce el error).
+ description: >-
+ Listado de suberrores usado para dar información más detallada, como en
+ el caso de errores de validación.
diff --git a/src/test/resources/checks/v32/operations/OAR092/with-ref.json b/src/test/resources/checks/v32/operations/OAR092/with-ref.json
new file mode 100644
index 00000000..e89f669d
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR092/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "summary": "Create a pet",
+ "requestBody": {
+ "$ref": "#/components/requestBodies/Pet"
+ },
+ "responses": {
+ "201": {
+ "description": "Pet created successfully"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "requestBodies": {
+ "Pet": {
+ "description": "The pet to create",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR092/with-ref.yaml b/src/test/resources/checks/v32/operations/OAR092/with-ref.yaml
new file mode 100644
index 00000000..209d8c49
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR092/with-ref.yaml
@@ -0,0 +1,33 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: '1.0.0'
+paths:
+ /pets:
+ post:
+ summary: Create a pet
+ requestBody:
+ $ref: '#/components/requestBodies/PetBody'
+ responses:
+ '201':
+ description: Pet created successfully
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+components:
+ requestBodies:
+ PetBody:
+ description: The pet to create
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ schemas:
+ Pet:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR093/no-ref.json b/src/test/resources/checks/v32/operations/OAR093/no-ref.json
new file mode 100644
index 00000000..5719e271
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR093/no-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Get all pets",
+ "responses": { # Noncompliant {{OAR093: Responses must contain only references ($ref)}}
+ "200": {
+ "description": "A list of pets",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR093/no-ref.yaml b/src/test/resources/checks/v32/operations/OAR093/no-ref.yaml
new file mode 100644
index 00000000..d51d8849
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR093/no-ref.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Get all pets
+ responses: # Noncompliant {{OAR093: Responses must contain only references ($ref)}}
+ '200':
+ description: A list of pets
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR093/with-ref.json b/src/test/resources/checks/v32/operations/OAR093/with-ref.json
new file mode 100644
index 00000000..47a4d19a
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR093/with-ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "summary": "Get all pets",
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/AllPets"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "AllPets": {
+ "description": "A list of pets",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "name": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR093/with-ref.yaml b/src/test/resources/checks/v32/operations/OAR093/with-ref.yaml
new file mode 100644
index 00000000..86f5b424
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR093/with-ref.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /pets:
+ get:
+ summary: Get all pets
+ responses:
+ '200':
+ $ref: '#/components/responses/AllPets'
+components:
+ responses:
+ AllPets:
+ description: A list of pets
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: object
+ properties:
+ id:
+ type: integer
+ name:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR103/plain.json b/src/test/resources/checks/v32/operations/OAR103/plain.json
new file mode 100644
index 00000000..a783189f
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR103/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (GETs only)"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR103: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR103: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR103/plain.yaml b/src/test/resources/checks/v32/operations/OAR103/plain.yaml
new file mode 100644
index 00000000..cfd44356
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR103/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (GETs only)
+paths:
+ /resources:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ get: # Noncompliant {{OAR103: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{delete}:
+ get: # Noncompliant {{OAR103: Operation not recommended for resource path: resources/{delete}}}
+ responses:
+ '200':
+ description: Ok
+ /hola/{r_id}/other:
+ get:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ get:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR104/plain.yaml b/src/test/resources/checks/v32/operations/OAR104/plain.yaml
new file mode 100644
index 00000000..7a1acb1c
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR104/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.2.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/me/cars:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ post: # Noncompliant {{OAR104: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/hello:
+ post: # Noncompliant {{OAR104: Operation not recommended for resource path: resources/hello}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ post:
+ responses:
+ '200':
+ description: Ok
+ /resources/search:
+ post:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR105/plain.json b/src/test/resources/checks/v32/operations/OAR105/plain.json
new file mode 100644
index 00000000..fa749740
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR105/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "put": { # Noncompliant {{OAR105: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "put": { # Noncompliant {{OAR105: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR105/plain.yaml b/src/test/resources/checks/v32/operations/OAR105/plain.yaml
new file mode 100644
index 00000000..e4d6a1c4
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR105/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ put: # Noncompliant {{OAR105: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ put: # Noncompliant {{OAR105: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ put:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ put:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR106/plain.json b/src/test/resources/checks/v32/operations/OAR106/plain.json
new file mode 100644
index 00000000..b486c05d
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR106/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "patch": { # Noncompliant {{OAR106: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "patch": { # Noncompliant {{OAR106: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR106/plain.yaml b/src/test/resources/checks/v32/operations/OAR106/plain.yaml
new file mode 100644
index 00000000..2e59b304
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR106/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ patch: # Noncompliant {{OAR106: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ patch: # Noncompliant {{OAR106: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ patch:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ patch:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR107/plain.json b/src/test/resources/checks/v32/operations/OAR107/plain.json
new file mode 100644
index 00000000..09d9c270
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR107/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore (POSTs only)"
+ },
+ "paths": {
+ "/resources": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "delete": { # Noncompliant {{OAR107: Operation not recommended for resource path: resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "delete": { # Noncompliant {{OAR107: Operation not recommended for resource path: resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/me": {
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR107/plain.yaml b/src/test/resources/checks/v32/operations/OAR107/plain.yaml
new file mode 100644
index 00000000..7607378b
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR107/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: '1.0.0'
+ title: Swagger Petstore (Posts only)
+paths:
+ /resources:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/get:
+ delete: # Noncompliant {{OAR107: Operation not recommended for resource path: resources/get}}
+ responses:
+ '200':
+ description: Ok
+ /resources/delete:
+ delete: # Noncompliant {{OAR107: Operation not recommended for resource path: resources/delete}}
+ responses:
+ '200':
+ description: Ok
+ /resources/{r_id}/other:
+ delete:
+ responses:
+ '200':
+ description: Ok
+ /resources/me:
+ delete:
+ responses:
+ '200':
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR109/plain.json b/src/test/resources/checks/v32/operations/OAR109/plain.json
new file mode 100644
index 00000000..cd036afa
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR109/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "delete": {
+ "summary": "Get API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/another": {
+ "delete": {
+ "summary": "Get another API status",
+ "responses": {
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ },
+ "/users": {
+ "delete": {
+ "summary": "Get all users",
+ "responses": { # Noncompliant {{OAR109: Use default instead of directly specifying 5XX codes}}
+ "400": {
+ "description": "Error"
+ },
+ "500": {
+ "description": "Internal Server Error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/operations/OAR109/plain.yaml b/src/test/resources/checks/v32/operations/OAR109/plain.yaml
new file mode 100644
index 00000000..1a124ed2
--- /dev/null
+++ b/src/test/resources/checks/v32/operations/OAR109/plain.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ delete:
+ summary: Get API status
+ responses:
+ '400':
+ description: error
+ /another:
+ delete:
+ summary: Get another API status
+ responses:
+ '400':
+ description: error
+ /users:
+ delete:
+ summary: Get all users
+ responses: # Noncompliant {{OAR109: Use default instead of directly specifying 5XX codes}}
+ '400':
+ description: Error
+ '500':
+ description: Internal Server Error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR070/no-numeric.json b/src/test/resources/checks/v32/owasp/OAR070/no-numeric.json
new file mode 100644
index 00000000..573471a4
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR070/no-numeric.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items/{param1}": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR070/no-numeric.yaml b/src/test/resources/checks/v32/owasp/OAR070/no-numeric.yaml
new file mode 100644
index 00000000..269f435d
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR070/no-numeric.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.2.0"
+ info:
+ version: 1.0.0
+ title: Swagger Petstore
+ paths:
+ /items/{param1}:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR070/numeric.json b/src/test/resources/checks/v32/owasp/OAR070/numeric.json
new file mode 100644
index 00000000..90725096
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR070/numeric.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items/{param1}": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "integer" # Noncompliant {{OAR070: Parameters in path shouldnt be numeric}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "error"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR070/numeric.yaml b/src/test/resources/checks/v32/owasp/OAR070/numeric.yaml
new file mode 100644
index 00000000..ece4727e
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR070/numeric.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.2.0"
+ info:
+ version: 1.0.0
+ title: Swagger Petstore
+ paths:
+ /items/{param1}:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: integer # Noncompliant {{OAR070: Parameters in path shouldnt be numeric}}
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.json b/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.json
new file mode 100644
index 00000000..ed73cfe4
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.json
@@ -0,0 +1,57 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Health Check Excluded Paths API"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "summary": "Health check - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health": {
+ "get": {
+ "summary": "Health endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/health-check": {
+ "get": {
+ "summary": "Health check endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/ping": {
+ "get": {
+ "summary": "Ping endpoint - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/liveness": {
+ "get": {
+ "summary": "Liveness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ },
+ "/readiness": {
+ "get": {
+ "summary": "Readiness probe - excluded from rate limit rule",
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.yaml b/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.yaml
new file mode 100644
index 00000000..d76f6c73
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/health-check-excluded.yaml
@@ -0,0 +1,41 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Health Check Excluded Paths API
+paths:
+ /status:
+ get:
+ summary: Health check - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health:
+ get:
+ summary: Health endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /health-check:
+ get:
+ summary: Health check endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /ping:
+ get:
+ summary: Ping endpoint - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /liveness:
+ get:
+ summary: Liveness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
+ /readiness:
+ get:
+ summary: Readiness probe - excluded from rate limit rule
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.json b/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.json
new file mode 100644
index 00000000..b65b4140
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.json
@@ -0,0 +1,29 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Non-compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": { # Noncompliant {{OAR073: API should include a 429 response to indicate rate limiting}}
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.yaml b/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.yaml
new file mode 100644
index 00000000..333e02bc
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/no-rate-limit.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Non-compliant API
+paths:
+ /param2:
+ get:
+ summary: Get a list of items
+ responses: # Noncompliant {{OAR073: API should include a 429 response to indicate rate limiting}}
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR073/no-responses.json b/src/test/resources/checks/v32/owasp/OAR073/no-responses.json
new file mode 100644
index 00000000..2f349079
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/no-responses.json
@@ -0,0 +1,14 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items with no responses key"
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/owasp/OAR073/no-responses.yaml b/src/test/resources/checks/v32/owasp/OAR073/no-responses.yaml
new file mode 100644
index 00000000..307433b4
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/no-responses.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Compliant API
+paths:
+ /items:
+ get:
+ summary: Get a list of items with no responses key
diff --git a/src/test/resources/checks/v32/owasp/OAR073/rate-limit.json b/src/test/resources/checks/v32/owasp/OAR073/rate-limit.json
new file mode 100644
index 00000000..4476389a
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/rate-limit.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Compliant API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "429": {
+ "description": "Too Many Requests",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/error_response"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/owasp/OAR073/rate-limit.yaml b/src/test/resources/checks/v32/owasp/OAR073/rate-limit.yaml
new file mode 100644
index 00000000..1b2663e8
--- /dev/null
+++ b/src/test/resources/checks/v32/owasp/OAR073/rate-limit.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Compliant API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 429:
+ description: Too Many Requests
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/error_response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/excluded.json b/src/test/resources/checks/v32/parameters/OAR019/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml
new file mode 100644
index 00000000..8a15d474
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /another:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/plain-without.json b/src/test/resources/checks/v32/parameters/OAR019/plain-without.json
new file mode 100644
index 00000000..a10bede3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR019/plain-without.yaml
new file mode 100644
index 00000000..43fea04b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/plain.json b/src/test/resources/checks/v32/parameters/OAR019/plain.json
new file mode 100644
index 00000000..2dcb585d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/plain.yaml b/src/test/resources/checks/v32/parameters/OAR019/plain.yaml
new file mode 100644
index 00000000..83ea62a7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $select
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.json
new file mode 100644
index 00000000..ce2463e3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "select" : {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/select"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.yaml
new file mode 100644
index 00000000..9ec37626
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ select:
+ in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/select'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR019/with-$ref.json
new file mode 100644
index 00000000..6306b273
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "select" : {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/select"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR019/with-$ref.yaml
new file mode 100644
index 00000000..a6e9d388
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ select:
+ in: query
+ name: $select
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/select'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-param.json b/src/test/resources/checks/v32/parameters/OAR019/with-param.json
new file mode 100644
index 00000000..64d4e9a0
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-param.yaml b/src/test/resources/checks/v32/parameters/OAR019/with-param.yaml
new file mode 100644
index 00000000..195ae044
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-ref.json b/src/test/resources/checks/v32/parameters/OAR019/with-ref.json
new file mode 100644
index 00000000..aa068c35
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "selectParameter": {
+ "in": "query",
+ "name": "$select",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/selectParameter"
+ }
+ ],
+ "responses": {
+ "206": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/with-ref.yaml b/src/test/resources/checks/v32/parameters/OAR019/with-ref.yaml
new file mode 100644
index 00000000..93b3e7d1
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/with-ref.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ parameters:
+ selectParameter:
+ in: query
+ name: $select
+ schema:
+ type: array
+ items:
+ type: string
+
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/selectParameter'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR019/without-parameters.json
new file mode 100644
index 00000000..071e3be7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR019/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR019/without-parameters.yaml
new file mode 100644
index 00000000..c033182d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR019/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR019: $select must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/excluded.json b/src/test/resources/checks/v32/parameters/OAR020/excluded.json
new file mode 100644
index 00000000..fc405edc
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR020/excluded.yaml
new file mode 100644
index 00000000..f802af70
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/excluded2.json b/src/test/resources/checks/v32/parameters/OAR020/excluded2.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/excluded2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/excluded2.yaml b/src/test/resources/checks/v32/parameters/OAR020/excluded2.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/excluded2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.json b/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.json
new file mode 100644
index 00000000..6806c9b8
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "expand",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.yaml b/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.yaml
new file mode 100644
index 00000000..2ee0ef79
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/expand-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain-without.json b/src/test/resources/checks/v32/parameters/OAR020/plain-without.json
new file mode 100644
index 00000000..229d51af
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR020/plain-without.yaml
new file mode 100644
index 00000000..dbcaf0b0
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain-without2.json b/src/test/resources/checks/v32/parameters/OAR020/plain-without2.json
new file mode 100644
index 00000000..60c2c790
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain-without2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain-without2.yaml b/src/test/resources/checks/v32/parameters/OAR020/plain-without2.yaml
new file mode 100644
index 00000000..a99252ed
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain-without2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain.json b/src/test/resources/checks/v32/parameters/OAR020/plain.json
new file mode 100644
index 00000000..75cdd4e2
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain.yaml b/src/test/resources/checks/v32/parameters/OAR020/plain.yaml
new file mode 100644
index 00000000..aebcb70f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain2.json b/src/test/resources/checks/v32/parameters/OAR020/plain2.json
new file mode 100644
index 00000000..81022af4
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain2.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/plain2.yaml b/src/test/resources/checks/v32/parameters/OAR020/plain2.yaml
new file mode 100644
index 00000000..63845223
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/plain2.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.json
new file mode 100644
index 00000000..b0781cb1
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "expand" : {
+ "in" : "query",
+ "name" : "expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/expand"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.yaml
new file mode 100644
index 00000000..40b18ee7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ expand:
+ in: query
+ name: expand
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/expand'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR020/with-$ref.json
new file mode 100644
index 00000000..649ebd53
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "expand" : {
+ "in" : "query",
+ "name" : "$expand",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/expand"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR020/with-$ref.yaml
new file mode 100644
index 00000000..508853fe
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ expand:
+ in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/expand'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-param.json b/src/test/resources/checks/v32/parameters/OAR020/with-param.json
new file mode 100644
index 00000000..64d4e9a0
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-param.yaml b/src/test/resources/checks/v32/parameters/OAR020/with-param.yaml
new file mode 100644
index 00000000..195ae044
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-ref.json b/src/test/resources/checks/v32/parameters/OAR020/with-ref.json
new file mode 100644
index 00000000..a9bfbbe5
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "selectParameter": {
+ "in": "query",
+ "name": "$expand",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/selectParameter"
+ }
+ ],
+ "responses": {
+ "206": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/with-ref.yaml b/src/test/resources/checks/v32/parameters/OAR020/with-ref.yaml
new file mode 100644
index 00000000..dd0f7f00
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/with-ref.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ parameters:
+ selectParameter:
+ in: query
+ name: $expand
+ schema:
+ type: array
+ items:
+ type: string
+
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/selectParameter'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR020/without-parameters.json
new file mode 100644
index 00000000..65eadc9c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR020/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR020/without-parameters.yaml
new file mode 100644
index 00000000..e6743395
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR020/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR020: $expand must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.json b/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.json
new file mode 100644
index 00000000..a31fedd7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "exclude",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.yaml b/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.yaml
new file mode 100644
index 00000000..19e8486f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/exclude-no-dollar.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR021/excluded.json b/src/test/resources/checks/v32/parameters/OAR021/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR021/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/plain-without.json b/src/test/resources/checks/v32/parameters/OAR021/plain-without.json
new file mode 100644
index 00000000..403592ed
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR021/plain-without.yaml
new file mode 100644
index 00000000..3f43a238
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/plain.json b/src/test/resources/checks/v32/parameters/OAR021/plain.json
new file mode 100644
index 00000000..68796bea
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/plain.yaml b/src/test/resources/checks/v32/parameters/OAR021/plain.yaml
new file mode 100644
index 00000000..b91b5aa7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.json
new file mode 100644
index 00000000..c7e863bc
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "exclude" : {
+ "in" : "query",
+ "name" : "exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/exclude"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.yaml
new file mode 100644
index 00000000..24b286ea
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ exclude:
+ in: query
+ name: exclude
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/exclude'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR021/with-$ref.json
new file mode 100644
index 00000000..09ca2bce
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "exclude" : {
+ "in" : "query",
+ "name" : "$exclude",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/exclude"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR021/with-$ref.yaml
new file mode 100644
index 00000000..80084da1
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ exclude:
+ in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/exclude'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-param.json b/src/test/resources/checks/v32/parameters/OAR021/with-param.json
new file mode 100644
index 00000000..64d4e9a0
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/examples/{id}/items/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-param.yaml b/src/test/resources/checks/v32/parameters/OAR021/with-param.yaml
new file mode 100644
index 00000000..195ae044
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-param.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+paths:
+ /examples/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
+ /examples/{id}/items/{id}:
+ get:
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-ref.json b/src/test/resources/checks/v32/parameters/OAR021/with-ref.json
new file mode 100644
index 00000000..ee94aab9
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-ref.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "selectParameter": {
+ "in": "query",
+ "name": "$exclude",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/selectParameter"
+ }
+ ],
+ "responses": {
+ "206": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/with-ref.yaml b/src/test/resources/checks/v32/parameters/OAR021/with-ref.yaml
new file mode 100644
index 00000000..78e6065c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/with-ref.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ parameters:
+ selectParameter:
+ in: query
+ name: $exclude
+ schema:
+ type: array
+ items:
+ type: string
+
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/selectParameter'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR021/without-parameters.json
new file mode 100644
index 00000000..b537b48c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR021/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR021/without-parameters.yaml
new file mode 100644
index 00000000..f89103af
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR021/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR021: $exclude must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/excluded.json b/src/test/resources/checks/v32/parameters/OAR022/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR022/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/plain-without.json b/src/test/resources/checks/v32/parameters/OAR022/plain-without.json
new file mode 100644
index 00000000..3b7f35b5
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR022/plain-without.yaml
new file mode 100644
index 00000000..a48e5de9
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/plain.json b/src/test/resources/checks/v32/parameters/OAR022/plain.json
new file mode 100644
index 00000000..64ee817f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/plain.yaml b/src/test/resources/checks/v32/parameters/OAR022/plain.yaml
new file mode 100644
index 00000000..014ef997
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.json
new file mode 100644
index 00000000..e2f6a956
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.yaml
new file mode 100644
index 00000000..c37a96fa
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR022/with-$ref.json
new file mode 100644
index 00000000..9bd7b4d8
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "$orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR022/with-$ref.yaml
new file mode 100644
index 00000000..a5830ace
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: $orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR022/without-parameters.json
new file mode 100644
index 00000000..8f203e14
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR022/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR022/without-parameters.yaml
new file mode 100644
index 00000000..6d44559d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR022: $orderby must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/excluded.json b/src/test/resources/checks/v32/parameters/OAR023/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR023/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/plain-without.json b/src/test/resources/checks/v32/parameters/OAR023/plain-without.json
new file mode 100644
index 00000000..3b1d996b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR023/plain-without.yaml
new file mode 100644
index 00000000..a37906a9
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/plain.json b/src/test/resources/checks/v32/parameters/OAR023/plain.json
new file mode 100644
index 00000000..62525829
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/plain.yaml b/src/test/resources/checks/v32/parameters/OAR023/plain.yaml
new file mode 100644
index 00000000..cb01e52e
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $total
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.json
new file mode 100644
index 00000000..7ce67652
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.yaml
new file mode 100644
index 00000000..39d8a2d8
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/with-$ref-without.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR023/with-$ref.json
new file mode 100644
index 00000000..b1505d41
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/with-$ref.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR023/with-$ref.yaml
new file mode 100644
index 00000000..57681126
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/with-$ref.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR023/without-parameters.json
new file mode 100644
index 00000000..3b3b169d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR023/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR023/without-parameters.yaml
new file mode 100644
index 00000000..d0d1537c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR023/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR023: $total must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/excluded.json b/src/test/resources/checks/v32/parameters/OAR024/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR024/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/plain-without.json b/src/test/resources/checks/v32/parameters/OAR024/plain-without.json
new file mode 100644
index 00000000..ea252e01
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR024/plain-without.yaml
new file mode 100644
index 00000000..e28fc84d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/plain.json b/src/test/resources/checks/v32/parameters/OAR024/plain.json
new file mode 100644
index 00000000..b12f1a74
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/plain.yaml b/src/test/resources/checks/v32/parameters/OAR024/plain.yaml
new file mode 100644
index 00000000..0bbe7a1a
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $start
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $start
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.json
new file mode 100644
index 00000000..bf2fff84
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "init" : {
+ "in" : "query",
+ "name" : "init",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/init"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.yaml
new file mode 100644
index 00000000..7ab95ac3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/with-$ref-without.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ init:
+ in: query
+ name: init
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/init'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR024/with-$ref.json
new file mode 100644
index 00000000..81fd4853
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/with-$ref.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "init" : {
+ "in" : "query",
+ "name" : "$start",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/init"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR024/with-$ref.yaml
new file mode 100644
index 00000000..8d77acb3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ init:
+ in: query
+ name: $start
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/init'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR024/without-parameters.json
new file mode 100644
index 00000000..eb2e1b45
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR024/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR024/without-parameters.yaml
new file mode 100644
index 00000000..d328e2ef
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR024/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR024: $start must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/excluded.json b/src/test/resources/checks/v32/parameters/OAR025/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR025/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/plain-without.json b/src/test/resources/checks/v32/parameters/OAR025/plain-without.json
new file mode 100644
index 00000000..b28514bf
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR025/plain-without.yaml
new file mode 100644
index 00000000..ae142906
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/plain.json b/src/test/resources/checks/v32/parameters/OAR025/plain.json
new file mode 100644
index 00000000..33ee1029
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/plain.yaml b/src/test/resources/checks/v32/parameters/OAR025/plain.yaml
new file mode 100644
index 00000000..ffee1572
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $limit
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $limit
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.json
new file mode 100644
index 00000000..fb10ee06
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "limit" : {
+ "in" : "query",
+ "name" : "limit",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/limit"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.yaml
new file mode 100644
index 00000000..bcf3e107
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/with-$ref-without.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ limit:
+ in: query
+ name: limit
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/limit'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR025/with-$ref.json
new file mode 100644
index 00000000..132d6207
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/with-$ref.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "limit" : {
+ "in" : "query",
+ "name" : "$limit",
+ "schema": {
+ "type" : "integer",
+ "format" : "int64"
+ }
+ }
+ }
+ },
+
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/limit"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR025/with-$ref.yaml
new file mode 100644
index 00000000..5f28da0c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/with-$ref.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ limit:
+ in: query
+ name: $limit
+ schema:
+ type: integer
+ format: int64
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/limit'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR025/without-parameters.json
new file mode 100644
index 00000000..3014da2f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR025/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR025/without-parameters.yaml
new file mode 100644
index 00000000..e4db4bfa
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR025: $limit must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.json b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.json
new file mode 100644
index 00000000..4e059c12
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : false
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.yaml b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.yaml
new file mode 100644
index 00000000..04298875
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-false.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: boolean
+ default: false
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.json b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.json
new file mode 100644
index 00000000..6844caab
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.yaml b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.yaml
new file mode 100644
index 00000000..b2af2310
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-with-defval-true.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $total
+ schema:
+ type: boolean
+ default: true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.json b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.json
new file mode 100644
index 00000000..82d1bd2c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, { # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.yaml b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.yaml
new file mode 100644
index 00000000..fc709154
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-with-$total-without-defval.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ name: $total
+ schema:
+ type: boolean
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.json b/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.json
new file mode 100644
index 00000000..2d9a45bf
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.yaml b/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.yaml
new file mode 100644
index 00000000..2dfc4ee7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/plain-without-$total.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: total
+ schema:
+ type: boolean
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.json b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.json
new file mode 100644
index 00000000..1a841cdb
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : false
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml
new file mode 100644
index 00000000..1562124c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-false.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+ default: false
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.json b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.json
new file mode 100644
index 00000000..578b4095
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean",
+ "default" : true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml
new file mode 100644
index 00000000..a172b3e6
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-with-defval-true.yaml
@@ -0,0 +1,28 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: $total
+ schema:
+ type: boolean
+ default: true # Noncompliant {{OAR026: The $total parameter default value should be false}}
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.json b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.json
new file mode 100644
index 00000000..0c9c05b7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : { # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ "in" : "query",
+ "name" : "$total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.yaml b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.yaml
new file mode 100644
index 00000000..3ac00495
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-with-$total-without-defval.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total: # Noncompliant {{OAR026: The $total parameter default value should be false}}
+ in: query
+ name: $total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.json b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.json
new file mode 100644
index 00000000..68f9d229
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.json
@@ -0,0 +1,44 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "total" : {
+ "in" : "query",
+ "name" : "total",
+ "schema": {
+ "type" : "boolean"
+ }
+ }
+ },
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/total"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.yaml b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.yaml
new file mode 100644
index 00000000..8af2a3c3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/with-$ref-without-$total.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ total:
+ in: query
+ name: total
+ schema:
+ type: boolean
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/total'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR026/without-parameters.json
new file mode 100644
index 00000000..c16b7e81
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR026/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR026/without-parameters.yaml
new file mode 100644
index 00000000..0ce657a4
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR026/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/components-param.json b/src/test/resources/checks/v32/parameters/OAR028/components-param.json
new file mode 100644
index 00000000..4100117a
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/components-param.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components" : {
+ "parameters" : {
+ "filterParam" : {
+ "in" : "query",
+ "name" : "$filter",
+ "schema" : {
+ "type" : "string"
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [
+ { "$ref" : "#/components/parameters/filterParam" }
+ ],
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR028/components-param.yaml b/src/test/resources/checks/v32/parameters/OAR028/components-param.yaml
new file mode 100644
index 00000000..3c123daa
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/components-param.yaml
@@ -0,0 +1,19 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ filterParam:
+ in: query
+ name: $filter
+ schema:
+ type: string
+paths:
+ /examples:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/filterParam'
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.json b/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.json
new file mode 100644
index 00000000..dd5444b7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/orders" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.yaml b/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.yaml
new file mode 100644
index 00000000..95435d14
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/exclude-noncompliant.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /orders:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR028/excluded.json b/src/test/resources/checks/v32/parameters/OAR028/excluded.json
new file mode 100644
index 00000000..8acbcce3
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/excluded.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR028/excluded.yaml
new file mode 100644
index 00000000..387db41b
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/excluded.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/header-ignored.json b/src/test/resources/checks/v32/parameters/OAR028/header-ignored.json
new file mode 100644
index 00000000..97b9946c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/header-ignored.json
@@ -0,0 +1,34 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "header",
+ "name" : "Authorization",
+ "schema" : {
+ "type" : "string"
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "schema" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR028/header-ignored.yaml b/src/test/resources/checks/v32/parameters/OAR028/header-ignored.yaml
new file mode 100644
index 00000000..1d451717
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/header-ignored.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: header
+ name: Authorization
+ schema:
+ type: string
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.json b/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.json
new file mode 100644
index 00000000..400ffab2
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "post" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{id}" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/users/me/settings" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/health" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/ping" : {
+ "get" : {
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.yaml b/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.yaml
new file mode 100644
index 00000000..8b22e1e8
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/me-health-ping.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ post:
+ responses:
+ 206:
+ description: Ok
+ /pets/{id}:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /users/me/settings:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /health:
+ get:
+ responses:
+ 206:
+ description: Ok
+ /ping:
+ get:
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR028/plain-without.json b/src/test/resources/checks/v32/parameters/OAR028/plain-without.json
new file mode 100644
index 00000000..9936131d
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/plain-without.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR028/plain-without.yaml b/src/test/resources/checks/v32/parameters/OAR028/plain-without.yaml
new file mode 100644
index 00000000..d31d6d18
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/plain-without.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: select
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR028/plain.json b/src/test/resources/checks/v32/parameters/OAR028/plain.json
new file mode 100644
index 00000000..1a95e034
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/plain.yaml b/src/test/resources/checks/v32/parameters/OAR028/plain.yaml
new file mode 100644
index 00000000..66990d53
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/plain.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples:
+ get:
+ parameters:
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.json b/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.json
new file mode 100644
index 00000000..8182a1ac
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "orderby",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.yaml b/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.yaml
new file mode 100644
index 00000000..26f4868a
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/with-$ref-without.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: orderby
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/with-$ref.json b/src/test/resources/checks/v32/parameters/OAR028/with-$ref.json
new file mode 100644
index 00000000..2e0e6920
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "components": {
+ "parameters" : {
+ "other" : {
+ "in" : "query",
+ "name" : "other",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ },
+ "orderby" : {
+ "in" : "query",
+ "name" : "$filter",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "parameters" : [ {
+ "$ref" : "#/components/parameters/other"
+ }, {
+ "$ref" : "#/components/parameters/orderby"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/with-$ref.yaml b/src/test/resources/checks/v32/parameters/OAR028/with-$ref.yaml
new file mode 100644
index 00000000..c3133401
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ other:
+ in: query
+ name: other
+ schema:
+ type: array
+ items:
+ type: string
+ orderby:
+ in: query
+ name: $filter
+ schema:
+ type: array
+ items:
+ type: string
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/other'
+ - $ref: '#/components/parameters/orderby'
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/without-parameters.json b/src/test/resources/checks/v32/parameters/OAR028/without-parameters.json
new file mode 100644
index 00000000..6ac4b9f5
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/without-parameters.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : { # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR028/without-parameters.yaml b/src/test/resources/checks/v32/parameters/OAR028/without-parameters.yaml
new file mode 100644
index 00000000..8301eadf
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR028/without-parameters.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get: # Noncompliant {{OAR028: $filter must be defined as a parameter in this operation}}
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR060/required-false.json b/src/test/resources/checks/v32/parameters/OAR060/required-false.json
new file mode 100644
index 00000000..b68a5697
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR060/required-false.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "required": false,
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "required": false,
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR060/required-false.yaml b/src/test/resources/checks/v32/parameters/OAR060/required-false.yaml
new file mode 100644
index 00000000..ffbdc316
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR060/required-false.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR060/required-true.json b/src/test/resources/checks/v32/parameters/OAR060/required-true.json
new file mode 100644
index 00000000..cf62bf43
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR060/required-true.json
@@ -0,0 +1,39 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "required": true, # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$filter",
+ "required": true, # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR060/required-true.yaml b/src/test/resources/checks/v32/parameters/OAR060/required-true.yaml
new file mode 100644
index 00000000..b6fbafbf
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR060/required-true.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - in: query
+ name: other
+ required: true # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ schema:
+ type: array
+ items:
+ type: string
+ - in: query
+ name: $filter
+ required: true # Noncompliant {{OAR060: All parameters in query must be defined as optional}}
+ schema:
+ type: array
+ items:
+ type: string
+ responses:
+ 206:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR069/bad-request400.json b/src/test/resources/checks/v32/parameters/OAR069/bad-request400.json
new file mode 100644
index 00000000..3ec0761c
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR069/bad-request400.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR069/bad-request400.yaml b/src/test/resources/checks/v32/parameters/OAR069/bad-request400.yaml
new file mode 100644
index 00000000..0257a31e
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR069/bad-request400.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 400:
+ description: Bad Request
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.json b/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.json
new file mode 100644
index 00000000..de68ddb7
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "parameters": [
+ { # Noncompliant {{OAR069: Any param in PATH or QUERY should have a Bad Request (400) response.}}
+ "name": "param1",
+ "in": "query",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.yaml b/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.yaml
new file mode 100644
index 00000000..12fa0e70
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR069/no-bad-request400.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ parameters:
+ - name: param1 # Noncompliant {{OAR069: Any param in PATH or QUERY should have a Bad Request (400) response.}}
+ in: query
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
diff --git a/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.json b/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.json
new file mode 100644
index 00000000..fc922fa8
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "externalDocs" : {
+ "description" : "lowercase external documentation", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "url" : "https://example.com"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.yaml
new file mode 100644
index 00000000..f4cd5bdf
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/external-docs-invalid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+externalDocs:
+ description: lowercase external documentation # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ url: https://example.com
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.json b/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.json
new file mode 100644
index 00000000..efb1324f
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "externalDocs" : {
+ "description" : "Valid external documentation",
+ "url" : "https://example.com"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.yaml b/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.yaml
new file mode 100644
index 00000000..a16877bf
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/external-docs-valid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+externalDocs:
+ description: Valid external documentation
+ url: https://example.com
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/info-invalid.json b/src/test/resources/checks/v32/regex/OAR112/info-invalid.json
new file mode 100644
index 00000000..8b00932e
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/info-invalid.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0",
+ "description" : "lowercase description" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/info-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/info-invalid.yaml
new file mode 100644
index 00000000..287bbbcc
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/info-invalid.yaml
@@ -0,0 +1,6 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+ description: lowercase description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/minimal.json b/src/test/resources/checks/v32/regex/OAR112/minimal.json
new file mode 100644
index 00000000..dcfa2d76
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/minimal.json
@@ -0,0 +1,8 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/minimal.yaml b/src/test/resources/checks/v32/regex/OAR112/minimal.yaml
new file mode 100644
index 00000000..229672f1
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/minimal.yaml
@@ -0,0 +1,5 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/missing-description.json b/src/test/resources/checks/v32/regex/OAR112/missing-description.json
new file mode 100644
index 00000000..8090d27d
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/missing-description.json
@@ -0,0 +1,8 @@
+{
+ "openapi" : "3.2.0",
+ "info" : { # Noncompliant {{OAR112: Expected to find a value but didn't.}}
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/missing-description.yaml b/src/test/resources/checks/v32/regex/OAR112/missing-description.yaml
new file mode 100644
index 00000000..32c89fee
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/missing-description.yaml
@@ -0,0 +1,5 @@
+openapi: "3.2.0"
+info: # Noncompliant {{OAR112: Expected to find a value but didn't.}}
+ title: Test API
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/operation-invalid.json b/src/test/resources/checks/v32/regex/OAR112/operation-invalid.json
new file mode 100644
index 00000000..f6384306
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/operation-invalid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "summary" : "lowercase operation summary", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/operation-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/operation-invalid.yaml
new file mode 100644
index 00000000..d4eea6c3
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/operation-invalid.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ summary: lowercase operation summary # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/regex/OAR112/operation-valid.json b/src/test/resources/checks/v32/regex/OAR112/operation-valid.json
new file mode 100644
index 00000000..a8558a04
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/operation-valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "summary" : "Valid Operation Summary",
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/operation-valid.yaml b/src/test/resources/checks/v32/regex/OAR112/operation-valid.yaml
new file mode 100644
index 00000000..41c58947
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/operation-valid.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ summary: Valid Operation Summary
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.json b/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.json
new file mode 100644
index 00000000..5768d11e
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "parameters" : [ {
+ "name" : "page",
+ "in" : "query",
+ "description" : "lowercase parameter description", # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ "schema" : {
+ "type" : "integer"
+ }
+ } ],
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.yaml
new file mode 100644
index 00000000..e5da10c4
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/parameters-invalid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ parameters:
+ - name: page
+ in: query
+ description: lowercase parameter description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ schema:
+ type: integer
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/regex/OAR112/parameters-valid.json b/src/test/resources/checks/v32/regex/OAR112/parameters-valid.json
new file mode 100644
index 00000000..c292eed7
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/parameters-valid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "paths" : {
+ "/test" : {
+ "get" : {
+ "parameters" : [ {
+ "name" : "page",
+ "in" : "query",
+ "description" : "Valid parameter description",
+ "schema" : {
+ "type" : "integer"
+ }
+ } ],
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/parameters-valid.yaml b/src/test/resources/checks/v32/regex/OAR112/parameters-valid.yaml
new file mode 100644
index 00000000..7a1c2510
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/parameters-valid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+paths:
+ /test:
+ get:
+ parameters:
+ - name: page
+ in: query
+ description: Valid parameter description
+ schema:
+ type: integer
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/regex/OAR112/plain.json b/src/test/resources/checks/v32/regex/OAR112/plain.json
new file mode 100644
index 00000000..ce410511
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/plain.json
@@ -0,0 +1,37 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }, {
+ "in" : "query",
+ "name" : "$select",
+ "schema": {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/regex/OAR112/plain.yaml b/src/test/resources/checks/v32/regex/OAR112/plain.yaml
new file mode 100644
index 00000000..07364470
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/plain.yaml
@@ -0,0 +1,46 @@
+openapi: "3.2.0"
+info:
+ title: Ejemplo de API
+ version: 1.0.0
+ description: Una API de ejemplo para ilustrar la estructura de OpenAPI.
+servers:
+ - url: https://api.ejemplo.com/v1
+paths:
+ /usuarios:
+ get:
+ summary: Obtiene una lista de usuarios
+ description: Retorna una lista completa de usuarios registrados.
+ operationId: getUsuarios
+ tags:
+ - Usuarios
+ parameters:
+ - name: "page"
+ in: "query"
+ description: "Número de página para la paginación"
+ required: false
+ schema:
+ type: "integer"
+ format: "int32"
+ responses:
+ '200':
+ description: ana lista de usuarios se retorna en caso de éxito.
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Usuario'
+ '404':
+ description: No se encontraron usuarios.
+components:
+ schemas:
+ Usuario:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ description: El ID único del usuario.
+ nombre:
+ type: string
+ description: El nombre del usuario.
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/regex/OAR112/servers-invalid.json b/src/test/resources/checks/v32/regex/OAR112/servers-invalid.json
new file mode 100644
index 00000000..0b80f6d3
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/servers-invalid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "servers" : [ {
+ "url" : "https://api.example.com",
+ "description" : "lowercase server description" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/servers-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/servers-invalid.yaml
new file mode 100644
index 00000000..4056de58
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/servers-invalid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com
+ description: lowercase server description # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/servers-valid.json b/src/test/resources/checks/v32/regex/OAR112/servers-valid.json
new file mode 100644
index 00000000..6c78c59a
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/servers-valid.json
@@ -0,0 +1,12 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "servers" : [ {
+ "url" : "https://api.example.com",
+ "description" : "Valid server description"
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/servers-valid.yaml b/src/test/resources/checks/v32/regex/OAR112/servers-valid.yaml
new file mode 100644
index 00000000..96b47c7a
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/servers-valid.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com
+ description: Valid server description
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/tags-invalid.json b/src/test/resources/checks/v32/regex/OAR112/tags-invalid.json
new file mode 100644
index 00000000..202ac69e
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/tags-invalid.json
@@ -0,0 +1,11 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "tags" : [ {
+ "name" : "invalidTag" # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/tags-invalid.yaml b/src/test/resources/checks/v32/regex/OAR112/tags-invalid.yaml
new file mode 100644
index 00000000..c09e07fe
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/tags-invalid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+tags:
+ - name: invalidTag # Noncompliant {{OAR112: The field must start with an uppercase letter.}}
+paths: {}
diff --git a/src/test/resources/checks/v32/regex/OAR112/tags-valid.json b/src/test/resources/checks/v32/regex/OAR112/tags-valid.json
new file mode 100644
index 00000000..151cfa52
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/tags-valid.json
@@ -0,0 +1,11 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "title" : "Test API",
+ "version" : "1.0.0"
+ },
+ "tags" : [ {
+ "name" : "ValidTag"
+ } ],
+ "paths" : {}
+}
diff --git a/src/test/resources/checks/v32/regex/OAR112/tags-valid.yaml b/src/test/resources/checks/v32/regex/OAR112/tags-valid.yaml
new file mode 100644
index 00000000..0119078a
--- /dev/null
+++ b/src/test/resources/checks/v32/regex/OAR112/tags-valid.yaml
@@ -0,0 +1,7 @@
+openapi: "3.2.0"
+info:
+ title: Test API
+ version: 1.0.0
+tags:
+ - name: ValidTag
+paths: {}
diff --git a/src/test/resources/checks/v32/resources/OAR008/plain.json b/src/test/resources/checks/v32/resources/OAR008/plain.json
new file mode 100644
index 00000000..1ff8ac46
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR008/plain.json
@@ -0,0 +1,60 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "patch" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "put" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "delete" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "head" : { # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "options" : { # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR008/plain.yaml b/src/test/resources/checks/v32/resources/OAR008/plain.yaml
new file mode 100644
index 00000000..f893e7d4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR008/plain.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ patch:
+ responses:
+ 200:
+ description: Ok
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+ head: # Noncompliant {{OAR008: Http verb (head) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+ options: # Noncompliant {{OAR008: Http verb (options) not encouraged}}
+ responses:
+ 200:
+ description: Ok
+
diff --git a/src/test/resources/checks/v32/resources/OAR013/plain.json b/src/test/resources/checks/v32/resources/OAR013/plain.json
new file mode 100644
index 00000000..f01ecf15
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR013/plain.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : { # Noncompliant {{OAR013: Default response is required}}
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ },
+ "post" : {
+ "responses" : {
+ "default" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR013/plain.yaml b/src/test/resources/checks/v32/resources/OAR013/plain.yaml
new file mode 100644
index 00000000..1c93c05c
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR013/plain.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR013: Default response is required}}
+ 200:
+ description: Ok
+ post:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR014/plain.json b/src/test/resources/checks/v32/resources/OAR014/plain.json
new file mode 100644
index 00000000..2777ce2c
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR014/plain.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR014/plain.yaml b/src/test/resources/checks/v32/resources/OAR014/plain.yaml
new file mode 100644
index 00000000..a5037c89
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR014/plain.yaml
@@ -0,0 +1,30 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR015/plain.json b/src/test/resources/checks/v32/resources/OAR015/plain.json
new file mode 100644
index 00000000..d2152946
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR015/plain.json
@@ -0,0 +1,72 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/one": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/one/two/three/four/five/six/seven": { # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR015/plain.yaml b/src/test/resources/checks/v32/resources/OAR015/plain.yaml
new file mode 100644
index 00000000..f29ada81
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR015/plain.yaml
@@ -0,0 +1,40 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five:
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
+ /one/two/three/four/five/six/seven: # Noncompliant {{OAR015: Resources depth level should be smaller}}
+ get:
+ responses:
+ default:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR017/plain.json b/src/test/resources/checks/v32/resources/OAR017/plain.json
new file mode 100644
index 00000000..54d66f97
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR017/plain.json
@@ -0,0 +1,63 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/one" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/{one}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/two" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}/three" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/one/{two}/{three}" : { # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR017/plain.yaml b/src/test/resources/checks/v32/resources/OAR017/plain.yaml
new file mode 100644
index 00000000..d3e714b9
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR017/plain.yaml
@@ -0,0 +1,58 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /one:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /{one}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/two: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/me:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/me/three:
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
+ get:
+ responses:
+ 200:
+ description: Ok
+
+ /me/items/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/resources/OAR018/plain.json b/src/test/resources/checks/v32/resources/OAR018/plain.json
new file mode 100644
index 00000000..7f33df14
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR018/plain.json
@@ -0,0 +1,194 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/resources": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": { # Noncompliant {{OAR018: Operation not recommended for resource path: POST /resources/{r_id}}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/get": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/get}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/delete": {
+ "get": { # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/delete}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/resources/{r_id}/other": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "put": { # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "patch": { # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ },
+ "delete": { # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/{r_id}/other}}
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR018/plain.yaml b/src/test/resources/checks/v32/resources/OAR018/plain.yaml
new file mode 100644
index 00000000..bae7d175
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR018/plain.yaml
@@ -0,0 +1,114 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /resources:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post: # Noncompliant {{OAR018: Operation not recommended for resource path: POST /resources/{r_id}}}
+ responses:
+ 200:
+ description: Ok
+ put:
+ responses:
+ 200:
+ description: Ok
+ patch:
+ responses:
+ 200:
+ description: Ok
+ delete:
+ responses:
+ 200:
+ description: Ok
+
+ /resources/get:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/get}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/get}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/delete:
+ get: # Noncompliant {{OAR018: Operation not recommended for resource path: GET /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/delete}}
+ responses:
+ 200:
+ description: Ok
+
+ /resources/{r_id}/other:
+ get:
+ responses:
+ 200:
+ description: Ok
+ post:
+ responses:
+ 200:
+ description: Ok
+ put: # Noncompliant {{OAR018: Operation not recommended for resource path: PUT /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ patch: # Noncompliant {{OAR018: Operation not recommended for resource path: PATCH /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
+ delete: # Noncompliant {{OAR018: Operation not recommended for resource path: DELETE /resources/{r_id}/other}}
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/no-post.json b/src/test/resources/checks/v32/resources/OAR027/no-post.json
new file mode 100644
index 00000000..b0d8cd88
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/no-post.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "201" : {
+ "description" : "Found"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/no-post.yaml b/src/test/resources/checks/v32/resources/OAR027/no-post.yaml
new file mode 100644
index 00000000..430d9384
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/no-post.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 201:
+ description: Found
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.json b/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.json
new file mode 100644
index 00000000..d0a66815
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : {
+ "Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.yaml b/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.yaml
new file mode 100644
index 00000000..8a83e03c
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-with-location.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers:
+ Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.json b/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.json
new file mode 100644
index 00000000..c8fd6785
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets/" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Created",
+ "headers" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "X-Location" : {
+ "schema": {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.yaml b/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.yaml
new file mode 100644
index 00000000..74e0450a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-with-other-headers.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets/:
+ post:
+ responses:
+ 201:
+ description: Created
+ headers: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ X-Location:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.json b/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.json
new file mode 100644
index 00000000..d5c533f8
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ "description" : "Created"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.yaml b/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.yaml
new file mode 100644
index 00000000..4b5ba620
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-201-without-location.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR027: Location header is required in responses with code 201 from POST operations}}
+ description: Created
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-no-201.json b/src/test/resources/checks/v32/resources/OAR027/post-no-201.json
new file mode 100644
index 00000000..af7a2bf5
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-no-201.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR027/post-no-201.yaml b/src/test/resources/checks/v32/resources/OAR027/post-no-201.yaml
new file mode 100644
index 00000000..89cbdd7a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR027/post-no-201.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ responses:
+ 200:
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.json b/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.json
new file mode 100644
index 00000000..103d68b4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.json
@@ -0,0 +1,134 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response_result"
+ },
+ {
+ "$ref": "#/components/schemas/standard_response_metadata"
+ }
+ ]
+ },
+ "standard_response_result": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "standard_response_metadata": {
+ "type": "object",
+ "properties": {
+ "metadata": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.yaml b/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.yaml
new file mode 100644
index 00000000..795fbdba
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-all-of-md.yaml
@@ -0,0 +1,78 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ standard_response_result:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
+ standard_response_metadata:
+ type: object
+ properties:
+ metadata:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-all-of.json b/src/test/resources/checks/v32/resources/OAR029/valid-all-of.json
new file mode 100644
index 00000000..aeff0e27
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-all-of.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response_result"
+ }, {
+ "$ref" : "#/components/schemas/standard_response_metadata"
+ } ],
+ "required" : [ "status" ]
+ },
+ "standard_response_result" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ },
+ "standard_response_metadata" : {
+ "properties" : {
+ "metadata" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-all-of.yaml b/src/test/resources/checks/v32/resources/OAR029/valid-all-of.yaml
new file mode 100644
index 00000000..35903cf7
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-all-of.yaml
@@ -0,0 +1,76 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ required:
+ - status
+ standard_response_result:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
+ standard_response_metadata:
+ properties:
+ metadata:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-md.json b/src/test/resources/checks/v32/resources/OAR029/valid-md.json
new file mode 100644
index 00000000..150c410b
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-md.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-md.yaml b/src/test/resources/checks/v32/resources/OAR029/valid-md.yaml
new file mode 100644
index 00000000..cd56b90d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-md.yaml
@@ -0,0 +1,69 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-r.json b/src/test/resources/checks/v32/resources/OAR029/valid-r.json
new file mode 100644
index 00000000..95e51635
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-r.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponseData"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "$ref": "#/components/responses/errorResponse"
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponseData": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponseData": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "errorResponse": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponseData"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid-r.yaml b/src/test/resources/checks/v32/resources/OAR029/valid-r.yaml
new file mode 100644
index 00000000..574b0a26
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid-r.yaml
@@ -0,0 +1,59 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponseData'
+ 204:
+ description: No content
+ 400:
+ $ref: '#/components/responses/errorResponse'
+ default:
+ description: Unknown
+components:
+ schemas:
+ successResponseData:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponseData:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
+ responses:
+ errorResponse:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponseData'
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid.json b/src/test/resources/checks/v32/resources/OAR029/valid.json
new file mode 100644
index 00000000..34e25331
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid.json
@@ -0,0 +1,105 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "status",
+ "data"
+ ]
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/valid.yaml b/src/test/resources/checks/v32/resources/OAR029/valid.yaml
new file mode 100644
index 00000000..d5b57932
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/valid.yaml
@@ -0,0 +1,69 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ required:
+ - data
+ - status
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.json b/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.json
new file mode 100644
index 00000000..bf3ca7b4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.json
@@ -0,0 +1,88 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer" # Noncompliant {{OAR029: 'code' must be of type string}}
+ },
+ "message": {
+ "type": "integer" # Noncompliant {{OAR029: 'message' must be of type string}}
+ },
+ "details": {
+ "type": "integer" # Noncompliant {{OAR029: 'details' must be of type array}}
+ },
+ "httpStatus": {
+ "type": "string" # Noncompliant {{OAR029: 'httpStatus' must be of type integer}}
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.yaml b/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.yaml
new file mode 100644
index 00000000..fd17ad18
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-with-properties-wrong-type-r.yaml
@@ -0,0 +1,55 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: integer # Noncompliant {{OAR029: 'code' must be of type string}}
+ message:
+ type: integer # Noncompliant {{OAR029: 'message' must be of type string}}
+ details:
+ type: integer # Noncompliant {{OAR029: 'details' must be of type array}}
+ httpStatus:
+ type: string # Noncompliant {{OAR029: 'httpStatus' must be of type integer}}
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.json b/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.json
new file mode 100644
index 00000000..928dedca
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.json
@@ -0,0 +1,75 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'details' property is missing}} {{OAR029: 'httpStatus' property is missing}} {{OAR029: 'message' property is missing}}
+ "type": "object",
+ "properties": {},
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.yaml b/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.yaml
new file mode 100644
index 00000000..004056a3
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-without-properties-r.yaml
@@ -0,0 +1,47 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'details' property is missing}} {{OAR029: 'httpStatus' property is missing}} {{OAR029: 'message' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - code
+ - message
+ - httpStatus
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.json b/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.json
new file mode 100644
index 00000000..19b70832
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "integer", # Noncompliant {{OAR029: 'error' must be of type object}}
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.yaml b/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.yaml
new file mode 100644
index 00000000..f6b69957
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-error-wrong-type-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: integer # Noncompliant {{OAR029: 'error' must be of type object}}
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.json b/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.json
new file mode 100644
index 00000000..8c2fbd68
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string" # Noncompliant {{OAR029: 'status' must be of type boolean}}
+ },
+ "http_code": {
+ "type": "string" # Noncompliant {{OAR029: 'http_code' must be of type integer}}
+ },
+ "errors": {
+ "type": "string" # Noncompliant {{OAR029: 'errors' must be of type array}}
+ },
+ "trace_id": {
+ "type": "integer" # Noncompliant {{OAR029: 'trace_id' must be of type string}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.yaml b/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.yaml
new file mode 100644
index 00000000..448733fa
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-with-properties-wrong-type-md.yaml
@@ -0,0 +1,56 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: string # Noncompliant {{OAR029: 'status' must be of type boolean}}
+ http_code:
+ type: string # Noncompliant {{OAR029: 'http_code' must be of type integer}}
+ errors:
+ type: string # Noncompliant {{OAR029: 'errors' must be of type array}}
+ trace_id:
+ type: integer # Noncompliant {{OAR029: 'trace_id' must be of type string}}
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.json b/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.json
new file mode 100644
index 00000000..fa173fa7
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.json
@@ -0,0 +1,80 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": { # Noncompliant {{OAR029: 'errors' property is missing}} {{OAR029: 'http_code' property is missing}} {{OAR029: 'status' property is missing}} {{OAR029: 'trace_id' property is missing}}
+ "type": "object",
+ "properties": {
+ },
+ "required": ["http_code", "status", "trace_id"]
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.yaml b/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.yaml
new file mode 100644
index 00000000..62abc35a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-without-properties-md.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result: # Noncompliant {{OAR029: 'errors' property is missing}} {{OAR029: 'http_code' property is missing}} {{OAR029: 'status' property is missing}} {{OAR029: 'trace_id' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - http_code
+ - status
+ - trace_id
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.json b/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.json
new file mode 100644
index 00000000..48ab3c52
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "integer", # Noncompliant {{OAR029: 'result' must be of type object}}
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.yaml b/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.yaml
new file mode 100644
index 00000000..e706d96b
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-result-wrong-type-md.yaml
@@ -0,0 +1,59 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: integer # Noncompliant {{OAR029: 'result' must be of type object}}
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties: {}
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.json b/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.json
new file mode 100644
index 00000000..f1f72fc4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.json
@@ -0,0 +1,90 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "boolean" # Noncompliant {{OAR029: 'http_status' must be of type string}}
+ },
+ "code" : {
+ "type" : "string" # Noncompliant {{OAR029: 'code' must be of type integer}}
+ },
+ "errors" : {
+ "type" : "string" # Noncompliant {{OAR029: 'errors' must be of type array}}
+ },
+ "description" : {
+ "type" : "integer" # Noncompliant {{OAR029: 'description' must be of type string}}
+ },
+ "internal_code" : {
+ "type" : "integer" # Noncompliant {{OAR029: 'internal_code' must be of type string}}
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.yaml b/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.yaml
new file mode 100644
index 00000000..15eacfbe
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-with-properties-wrong-type.yaml
@@ -0,0 +1,59 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: boolean # Noncompliant {{OAR029: 'http_status' must be of type string}}
+ code:
+ type: string # Noncompliant {{OAR029: 'code' must be of type integer}}
+ errors:
+ type: string # Noncompliant {{OAR029: 'errors' must be of type array}}
+ description:
+ type: integer # Noncompliant {{OAR029: 'description' must be of type string}}
+ internal_code:
+ type: integer # Noncompliant {{OAR029: 'internal_code' must be of type string}}
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.json b/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.json
new file mode 100644
index 00000000..dbbd033e
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.json
@@ -0,0 +1,74 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : { # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'description' property is missing}} {{OAR029: 'errors' property is missing}} {{OAR029: 'http_status' property is missing}} {{OAR029: 'internal_code' property is missing}}
+ "type" : "object",
+ "properties" : { },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.yaml b/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.yaml
new file mode 100644
index 00000000..69406256
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-without-properties.yaml
@@ -0,0 +1,49 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status: # Noncompliant {{OAR029: 'code' property is missing}} {{OAR029: 'description' property is missing}} {{OAR029: 'errors' property is missing}} {{OAR029: 'http_status' property is missing}} {{OAR029: 'internal_code' property is missing}}
+ type: object
+ properties: {}
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.json b/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.json
new file mode 100644
index 00000000..e604523d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "integer", # Noncompliant {{OAR029: 'status' must be of type object}}
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.yaml b/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.yaml
new file mode 100644
index 00000000..8ae8cda4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/with-status-wrong-type.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: integer # Noncompliant {{OAR029: 'status' must be of type object}}
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-data-md.json b/src/test/resources/checks/v32/resources/OAR029/without-data-md.json
new file mode 100644
index 00000000..2c897e92
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-data-md.json
@@ -0,0 +1,103 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR029: 'data' property is missing}}
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-data-md.yaml b/src/test/resources/checks/v32/resources/OAR029/without-data-md.yaml
new file mode 100644
index 00000000..2585ab57
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-data-md.yaml
@@ -0,0 +1,61 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'data' property is missing}}
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-data.json b/src/test/resources/checks/v32/resources/OAR029/without-data.json
new file mode 100644
index 00000000..20f98676
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-data.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR029: 'data' property is missing}}
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "value" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-data.yaml b/src/test/resources/checks/v32/resources/OAR029/without-data.yaml
new file mode 100644
index 00000000..d9688279
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-data.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'data' property is missing}}
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ value:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-error-r.json b/src/test/resources/checks/v32/resources/OAR029/without-error-r.json
new file mode 100644
index 00000000..bb63d29a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-error-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": { # Noncompliant {{OAR029: 'error' property is missing}}
+ "type": "object",
+ "properties": {
+ "result": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-error-r.yaml b/src/test/resources/checks/v32/resources/OAR029/without-error-r.yaml
new file mode 100644
index 00000000..e548f45d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-error-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse: # Noncompliant {{OAR029: 'error' property is missing}}
+ type: object
+ properties:
+ result:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-payload-r.json b/src/test/resources/checks/v32/resources/OAR029/without-payload-r.json
new file mode 100644
index 00000000..5929ab6b
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-payload-r.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": { # Noncompliant {{OAR029: 'payload' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-payload-r.yaml b/src/test/resources/checks/v32/resources/OAR029/without-payload-r.yaml
new file mode 100644
index 00000000..184c4c24
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-payload-r.yaml
@@ -0,0 +1,57 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse: # Noncompliant {{OAR029: 'payload' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.json b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.json
new file mode 100644
index 00000000..bd890695
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.json
@@ -0,0 +1,107 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "result": {
+ "required": ["status"], # Noncompliant {{OAR029: The following fields must be required: http_code, status, trace_id}}
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.yaml b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.yaml
new file mode 100644
index 00000000..a78c5d44
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-md.yaml
@@ -0,0 +1,64 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ result:
+ required: # Noncompliant {{OAR029: The following fields must be required: http_code, status, trace_id}}
+ - status
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.json b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.json
new file mode 100644
index 00000000..0373d81a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.json
@@ -0,0 +1,89 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponse"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponse"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponse": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponse": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [ # Noncompliant {{OAR029: The following fields must be required: code, httpStatus, message}}
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.yaml b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.yaml
new file mode 100644
index 00000000..26ce647a
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields-r.yaml
@@ -0,0 +1,55 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponse'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponse'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ successResponse:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponse:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required: # Noncompliant {{OAR029: The following fields must be required: code, httpStatus, message}}
+ - httpStatus
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields.json b/src/test/resources/checks/v32/resources/OAR029/without-required-fields.json
new file mode 100644
index 00000000..323273cb
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status" ] # Noncompliant {{OAR029: The following fields must be required: code, description, errors, http_status}}
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-required-fields.yaml b/src/test/resources/checks/v32/resources/OAR029/without-required-fields.yaml
new file mode 100644
index 00000000..f111d5fb
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-required-fields.yaml
@@ -0,0 +1,63 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required: # Noncompliant {{OAR029: The following fields must be required: code, description, errors, http_status}}
+ - http_status
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-result-md.json b/src/test/resources/checks/v32/resources/OAR029/without-result-md.json
new file mode 100644
index 00000000..1c5066dc
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-result-md.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR029: 'result' property is missing}}
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ]
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "string"
+ }
+ }
+ },
+ "response": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-result-md.yaml b/src/test/resources/checks/v32/resources/OAR029/without-result-md.yaml
new file mode 100644
index 00000000..18eacca4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-result-md.yaml
@@ -0,0 +1,59 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'result' property is missing}}
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ standard_response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ response:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties: {}
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-status.json b/src/test/resources/checks/v32/resources/OAR029/without-status.json
new file mode 100644
index 00000000..c748f46f
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-status.json
@@ -0,0 +1,101 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR029: 'status' property is missing}}
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR029/without-status.yaml b/src/test/resources/checks/v32/resources/OAR029/without-status.yaml
new file mode 100644
index 00000000..272e3e26
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR029/without-status.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response: # Noncompliant {{OAR029: 'status' property is missing}}
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ response:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
diff --git a/src/test/resources/checks/v32/resources/OAR030/valid.json b/src/test/resources/checks/v32/resources/OAR030/valid.json
new file mode 100644
index 00000000..9fb64210
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR030/valid.yaml b/src/test/resources/checks/v32/resources/OAR030/valid.yaml
new file mode 100644
index 00000000..b084d2f4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.json b/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.json
new file mode 100644
index 00000000..de85e0af
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/status" : { # Noncompliant {{OAR030: Method get must be declared}}
+ "post" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.yaml b/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.yaml
new file mode 100644
index 00000000..c5b262df
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/with-status-without-get.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status: # Noncompliant {{OAR030: Method get must be declared}}
+ post:
+ responses:
+ 200:
+ description: Ok
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR030/without-status.json b/src/test/resources/checks/v32/resources/OAR030/without-status.json
new file mode 100644
index 00000000..15d69e15
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/without-status.json
@@ -0,0 +1,18 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : { # Noncompliant {{OAR030: The path '/status' must be declared}}
+ "/other" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR030/without-status.yaml b/src/test/resources/checks/v32/resources/OAR030/without-status.yaml
new file mode 100644
index 00000000..1c969a70
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR030/without-status.yaml
@@ -0,0 +1,10 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths: # Noncompliant {{OAR030: The path '/status' must be declared}}
+ /other:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR031/valid.json b/src/test/resources/checks/v32/resources/OAR031/valid.json
new file mode 100644
index 00000000..d51f7834
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR031/valid.json
@@ -0,0 +1,170 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "responses": {
+ "201": {
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Puppy",
+ "type": "dog"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ },
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Pet created",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ },
+ "example": {
+ "size": 2,
+ "pets": [
+ {
+ "name": "Fluffy",
+ "type": "cat"
+ },
+ {
+ "name": "Sparky",
+ "type": "dog"
+ }
+ ]
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ },
+ "example": {
+ "name": "Fluffy",
+ "type": "cat"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": {
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true,
+ "example": 513168138
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "example": "Snow"
+ },
+ "type": {
+ "type": "string",
+ "example": "dog"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": {
+ "type": "integer",
+ "example": 1
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": {
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "example": "Server error"
+ }
+ }
+ },
+ "example": {
+ "error": "Server error"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR031/valid.yaml b/src/test/resources/checks/v32/resources/OAR031/valid.yaml
new file mode 100644
index 00000000..5dc80af7
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR031/valid.yaml
@@ -0,0 +1,113 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Puppy
+ type: dog
+ responses:
+ 201:
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pet'
+ example:
+ name: Puppy
+ type: dog
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+ get:
+ responses:
+ 204:
+ description: No content
+ 206:
+ description: Pet created
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ example:
+ size: 2
+ pets:
+ - name: Fluffy
+ type: cat
+ - name: Sparky
+ type: dog
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200:
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ example:
+ name: Fluffy
+ type: cat
+ 204:
+ description: No content
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ example: 513168138
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+
+ schemas:
+ pet:
+ type: object
+ properties:
+ name:
+ type: string
+ example: "Snow"
+ type:
+ type: string
+ example: "dog"
+ pets:
+ type: object
+ properties:
+ size:
+ type: integer
+ example: 1
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response:
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error:
+ type: string
+ example: "Server error"
+ example:
+ error: "Server error"
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR031/without-examples.json b/src/test/resources/checks/v32/resources/OAR031/without-examples.json
new file mode 100644
index 00000000..6901f337
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR031/without-examples.json
@@ -0,0 +1,120 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Pet list",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pets"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "parameters": [
+ { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "query",
+ "name": "$start",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/id"
+ }
+ ],
+ "responses": {
+ "200": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "One pet",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ },
+ "default": {
+ "$ref": "#/components/responses/server_error_response"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "parameters": {
+ "id": { # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ "in": "path",
+ "name": "id",
+ "schema": {
+ "type": "integer",
+ "format": "int64",
+ "maxLength": 22
+ },
+ "description": "Identificador del tipo de centro a obtener, actualizar o eliminar.",
+ "required": true
+ }
+ },
+ "schemas": {
+ "pet": {
+ "type": "object",
+ "properties": {
+ "name": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ },
+ "type": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ },
+ "pets": {
+ "type": "object",
+ "properties": {
+ "size": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "integer"
+ },
+ "pets": {
+ "type": "array",
+ "items": {
+ "$ref": "#/components/schemas/pet"
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "server_error_response": { # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ "description": "Default error response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": { # Noncompliant {{OAR031: Properties must have an example defined}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR031/without-examples.yaml b/src/test/resources/checks/v32/resources/OAR031/without-examples.yaml
new file mode 100644
index 00000000..9f62c796
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR031/without-examples.yaml
@@ -0,0 +1,73 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Pet list
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/pets'
+ default:
+ $ref: "#/components/responses/server_error_response"
+ /pets/{id}:
+ parameters:
+ - in: query # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: $start
+ schema:
+ type: integer
+ get:
+ parameters:
+ - $ref: "#/components/parameters/id"
+ responses:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: One pet
+ content:
+ application/json:
+ schema:
+ $ref: "#/components/schemas/pet"
+ default:
+ $ref: "#/components/responses/server_error_response"
+
+components:
+ parameters:
+ id:
+ in: path # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
+ name: id
+ schema:
+ type: integer
+ format: int64
+ maxLength: 22
+ description: Identificador del tipo de centro a obtener, actualizar o eliminar.
+ required: true
+ schemas:
+ pet:
+ type: object
+ properties:
+ name: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ type: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
+ pets:
+ type: object
+ properties:
+ size: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: integer
+ pets:
+ type: array
+ items:
+ $ref: '#/components/schemas/pet'
+ responses:
+ server_error_response: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
+ description: Default error response
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ error: # Noncompliant {{OAR031: Properties must have an example defined}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR032/forbidden-names.json b/src/test/resources/checks/v32/resources/OAR032/forbidden-names.json
new file mode 100644
index 00000000..e0a00540
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR032/forbidden-names.json
@@ -0,0 +1,36 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/elements" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/a/nested/items" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/another/{param}/with/valores" : { # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR032/forbidden-names.yaml b/src/test/resources/checks/v32/resources/OAR032/forbidden-names.yaml
new file mode 100644
index 00000000..babefe4b
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR032/forbidden-names.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /elements: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: elements}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /a/nested/items: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: items}}
+ get:
+ responses:
+ 200:
+ description: Ok
+ /another/{param}/with/valores: # Noncompliant {{OAR032: Ambiguous path parts not encouraged: valores}}
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR032/valid.json b/src/test/resources/checks/v32/resources/OAR032/valid.json
new file mode 100644
index 00000000..6360b965
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR032/valid.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ },
+ "/pets/{elements}" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR032/valid.yaml b/src/test/resources/checks/v32/resources/OAR032/valid.yaml
new file mode 100644
index 00000000..2b13ba92
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR032/valid.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 200:
+ description: Ok
+ /pets/{elements}:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/valid-all-of.json b/src/test/resources/checks/v32/resources/OAR034/valid-all-of.json
new file mode 100644
index 00000000..4f3fba7d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/valid-all-of.json
@@ -0,0 +1,126 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "first": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "previous": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "next": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "last": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/valid-all-of.yaml b/src/test/resources/checks/v32/resources/OAR034/valid-all-of.yaml
new file mode 100644
index 00000000..4ac9e62d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/valid-all-of.yaml
@@ -0,0 +1,84 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ first:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ previous:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ next:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ last:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/valid.json b/src/test/resources/checks/v32/resources/OAR034/valid.json
new file mode 100644
index 00000000..2cb72555
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/valid.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/valid.yaml b/src/test/resources/checks/v32/resources/OAR034/valid.yaml
new file mode 100644
index 00000000..9ce953bc
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/valid.yaml
@@ -0,0 +1,79 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.json b/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.json
new file mode 100644
index 00000000..1bdd1995
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.json
@@ -0,0 +1,96 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": { # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.yaml b/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.yaml
new file mode 100644
index 00000000..f95e48fc
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-links-without-properties.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links: # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.json b/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.json
new file mode 100644
index 00000000..f8fe57f8
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.json
@@ -0,0 +1,91 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "string" # Noncompliant {{OAR034: 'start' must be of type integer}}
+ },
+ "limit": {
+ "type": "string" # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ },
+ "total": {
+ "type": "string" # Noncompliant {{OAR034: 'total' must be of type integer}}
+ },
+ "numPages": {
+ "type": "string" # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ },
+ "links": {
+ "type": "string", # Noncompliant {{OAR034: 'links' must be of type object}}
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.yaml b/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.yaml
new file mode 100644
index 00000000..78576885
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-with-properties-wrong-types.yaml
@@ -0,0 +1,63 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: string # Noncompliant {{OAR034: 'start' must be of type integer}}
+ limit:
+ type: string # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ total:
+ type: string # Noncompliant {{OAR034: 'total' must be of type integer}}
+ numPages:
+ type: string # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ links:
+ type: string # Noncompliant {{OAR034: 'links' must be of type object}}
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.json b/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.json
new file mode 100644
index 00000000..72ba97fc
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": { # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.yaml b/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.yaml
new file mode 100644
index 00000000..cc402f14
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-without-properties.yaml
@@ -0,0 +1,51 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging: # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.json b/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.json
new file mode 100644
index 00000000..90235313
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.json
@@ -0,0 +1,73 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "string", # Noncompliant {{OAR034: 'paging' must be of type object}}
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.yaml b/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.yaml
new file mode 100644
index 00000000..fab5fa73
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/with-paging-wrong-type.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: string # Noncompliant {{OAR034: 'paging' must be of type object}}
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.json b/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.json
new file mode 100644
index 00000000..26ec828e
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self" ] # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.yaml b/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.yaml
new file mode 100644
index 00000000..944a6250
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-links-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required: # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ - self
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.json b/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.json
new file mode 100644
index 00000000..c8997771
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start" ] # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.yaml b/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.yaml
new file mode 100644
index 00000000..68bf3f34
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-pagination-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required: # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ - start
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-paging.json b/src/test/resources/checks/v32/resources/OAR034/without-paging.json
new file mode 100644
index 00000000..2a3aabff
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-paging.json
@@ -0,0 +1,61 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR034: 'paging' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR034/without-paging.yaml b/src/test/resources/checks/v32/resources/OAR034/without-paging.yaml
new file mode 100644
index 00000000..c0dbc57c
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR034/without-paging.yaml
@@ -0,0 +1,37 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR034: 'paging' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.json b/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.json
new file mode 100644
index 00000000..12fc95b7
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.json
@@ -0,0 +1,48 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ },
+ "name" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.yaml b/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.yaml
new file mode 100644
index 00000000..d5abbc7b
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-multiple-properties.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-one-property.json b/src/test/resources/checks/v32/resources/OAR038/valid-one-property.json
new file mode 100644
index 00000000..2962b123
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-one-property.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "id" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-one-property.yaml b/src/test/resources/checks/v32/resources/OAR038/valid-one-property.yaml
new file mode 100644
index 00000000..64779efd
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-one-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-with-error.json b/src/test/resources/checks/v32/resources/OAR038/valid-with-error.json
new file mode 100644
index 00000000..dd00601d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-with-error.json
@@ -0,0 +1 @@
+{"openapi":"3.2.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"}}}}}}}}
diff --git a/src/test/resources/checks/v32/resources/OAR038/valid-with-error.yaml b/src/test/resources/checks/v32/resources/OAR038/valid-with-error.yaml
new file mode 100644
index 00000000..9aaaed7e
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/valid-with-error.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ message:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.json b/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.json
new file mode 100644
index 00000000..c3ce41b1
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.json
@@ -0,0 +1,2 @@
+{"openapi":"3.2.0","info":{"version":"1.0.0","title":"Swagger Petstore"},"paths":{"/endpoint":{"post":{"responses":{"201":{"description":"Ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/response"}}}},"204":{"description":"No content"}}}}},"components":{"schemas":{"response":{"type":"object","properties":{"invalid_name" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type":"object","properties":{"id":{"type":"string"}}}}}}}}}
diff --git a/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.yaml b/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.yaml
new file mode 100644
index 00000000..f46de733
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/with-invalid-property.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ invalid_name: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
+ properties:
+ id:
+ type: string
diff --git a/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.json b/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.json
new file mode 100644
index 00000000..d8e8fe72
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.json
@@ -0,0 +1,41 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response" : {
+ "type" : "object",
+ "properties" : {
+ "data" : { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type" : "object",
+ "properties" : { }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.yaml b/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.yaml
new file mode 100644
index 00000000..853cc923
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/with-properties-empty.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+ properties: {}
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-data.json b/src/test/resources/checks/v32/resources/OAR038/without-data.json
new file mode 100644
index 00000000..bc4b778d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-data.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : {
+ "description" : "Ok",
+ "content": {
+ "application/json":{
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : { # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ "type" : "object"
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-data.yaml b/src/test/resources/checks/v32/resources/OAR038/without-data.yaml
new file mode 100644
index 00000000..910af91c
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-data.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR038: 'data' or 'error' property is required}}
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-properties.json b/src/test/resources/checks/v32/resources/OAR038/without-properties.json
new file mode 100644
index 00000000..e16e924d
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-properties.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "post": {
+ "responses": {
+ "201": {
+ "$ref": "#/components/responses/createResponse"
+ },
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/post_response"
+ }
+ ]
+ },
+ "post_response": {
+ "type": "object",
+ "properties": {
+ "data": { # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ "type": "object"
+ }
+ }
+ }
+ },
+ "responses": {
+ "createResponse": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-properties.yaml b/src/test/resources/checks/v32/resources/OAR038/without-properties.yaml
new file mode 100644
index 00000000..ab65b6ae
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-properties.yaml
@@ -0,0 +1,33 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201:
+ $ref: '#/components/responses/createResponse'
+ 204:
+ description: No content
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/post_response'
+
+ post_response:
+ type: object
+ properties:
+ data: # Noncompliant {{OAR038: At least you have to define the identifier property}}
+ type: object
+
+ responses:
+ createResponse:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-schema.json b/src/test/resources/checks/v32/resources/OAR038/without-schema.json
new file mode 100644
index 00000000..4e661996
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-schema.json
@@ -0,0 +1,21 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "post" : {
+ "responses" : {
+ "201" : { # Noncompliant {{OAR038: Response schema is required}}
+ "description" : "Ok"
+ },
+ "204" : {
+ "description" : "No content"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR038/without-schema.yaml b/src/test/resources/checks/v32/resources/OAR038/without-schema.yaml
new file mode 100644
index 00000000..6d2d9070
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR038/without-schema.yaml
@@ -0,0 +1,12 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ post:
+ responses:
+ 201: # Noncompliant {{OAR038: Response schema is required}}
+ description: Ok
+ 204:
+ description: No content
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR039/missing-codes.json b/src/test/resources/checks/v32/resources/OAR039/missing-codes.json
new file mode 100644
index 00000000..0a97606f
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR039/missing-codes.json
@@ -0,0 +1,109 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "put": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "patch": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ },
+ "delete": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": { # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR039/missing-codes.yaml b/src/test/resources/checks/v32/resources/OAR039/missing-codes.yaml
new file mode 100644
index 00000000..a3761ff4
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR039/missing-codes.yaml
@@ -0,0 +1,68 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 or 206 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}:
+ get:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ put:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ patch:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+ delete:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 or 201 or 202 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/get:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /pets/{id}/owner/delete:
+ post:
+ responses: # Noncompliant {{OAR039: Response code 200 must be defined}} {{OAR039: Response code 400 must be defined}} {{OAR039: Response code 404 must be defined}} {{OAR039: Response code 415 must be defined}} {{OAR039: Response code 500 must be defined}} {{OAR039: Response code 503 must be defined}}
+ default:
+ description: Unexpected error
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR039/valid.json b/src/test/resources/checks/v32/resources/OAR039/valid.json
new file mode 100644
index 00000000..e0abd6e0
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR039/valid.json
@@ -0,0 +1,283 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Partial collection"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "put": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "patch": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ },
+ "delete": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner": {
+ "post": {
+ "responses": {
+ "201": {
+ "description": "Created"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/get": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/pets/{id}/owner/delete": {
+ "post": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "400": {
+ "description": "Bad request"
+ },
+ "404": {
+ "description": "Not found"
+ },
+ "413": {
+ "description": "Payload too large"
+ },
+ "415": {
+ "description": "Unsupported media type"
+ },
+ "500": {
+ "description": "Internal server error"
+ },
+ "503": {
+ "description": "Service unavailable"
+ }
+ }
+ }
+ },
+ "/status": {
+ "get": {
+ "responses": {
+ "default": {
+ "description": "Unexpected error"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/resources/OAR039/valid.yaml b/src/test/resources/checks/v32/resources/OAR039/valid.yaml
new file mode 100644
index 00000000..6d1fc278
--- /dev/null
+++ b/src/test/resources/checks/v32/resources/OAR039/valid.yaml
@@ -0,0 +1,184 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ 206:
+ description: Partial collection
+ 400:
+ description: Bad request
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}:
+ get:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ put:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ patch:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+ delete:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner:
+ post:
+ responses:
+ 201:
+ description: Created
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/get:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /pets/{id}/owner/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
+ 400:
+ description: Bad request
+ 404:
+ description: Not found
+ 413:
+ description: Payload too large
+ 415:
+ description: Unsupported media type
+ 500:
+ description: Internal server error
+ 503:
+ description: Service unavailable
+
+ /status:
+ get:
+ responses:
+ default:
+ description: Unexpected error
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.json b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.json
new file mode 100644
index 00000000..6523cebc
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.json
@@ -0,0 +1,134 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response_result"
+ },
+ {
+ "$ref": "#/components/schemas/standard_response_metadata"
+ }
+ ]
+ },
+ "standard_response_result": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "standard_response_metadata": {
+ "type": "object",
+ "properties": {
+ "metadata": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.yaml b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.yaml
new file mode 100644
index 00000000..795fbdba
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of-md.yaml
@@ -0,0 +1,78 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ standard_response_result:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
+ standard_response_metadata:
+ type: object
+ properties:
+ metadata:
+ type: string
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.json b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.json
new file mode 100644
index 00000000..7ded0e59
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response" : {
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response_result"
+ }, {
+ "$ref" : "#/components/schemas/standard_response_metadata"
+ } ],
+ "required" : [ "status" ]
+ },
+ "standard_response_result" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ },
+ "standard_response_metadata" : {
+ "properties" : {
+ "metadata" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.yaml b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.yaml
new file mode 100644
index 00000000..35903cf7
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-all-of.yaml
@@ -0,0 +1,76 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response_result'
+ - $ref: '#/components/schemas/standard_response_metadata'
+ required:
+ - status
+ standard_response_result:
+ type: object
+ properties:
+ status:
+ type: object
+ properties:
+ http_status:
+ type: string
+ code:
+ type: integer
+ errors:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type: string
+ description:
+ type: string
+ internal_code:
+ type: string
+ required:
+ - http_status
+ - code
+ - description
+ - errors
+ standard_response_metadata:
+ properties:
+ metadata:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-md.json b/src/test/resources/checks/v32/schemas/OAR029/valid-md.json
new file mode 100644
index 00000000..2fe3e030
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-md.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "title": "Swagger Petstore",
+ "version": "1.0.0"
+ },
+ "servers": [
+ {
+ "url": "/"
+ }
+ ],
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content",
+ "content": {
+ }
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown",
+ "content": {
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "allOf": [
+ {
+ "$ref": "#/components/schemas/standard_response"
+ }
+ ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "standard_response": {
+ "type": "object",
+ "properties": {
+ "result": {
+ "required": [
+ "http_code",
+ "status",
+ "trace_id"
+ ],
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "boolean"
+ },
+ "http_code": {
+ "type": "integer"
+ },
+ "errors": {
+ "type": "array",
+ "items": {
+ "required": [
+ "code",
+ "message"
+ ],
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer"
+ },
+ "message": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "trace_id": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-md.yaml b/src/test/resources/checks/v32/schemas/OAR029/valid-md.yaml
new file mode 100644
index 00000000..cd56b90d
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-md.yaml
@@ -0,0 +1,69 @@
+openapi: "3.2.0"
+info:
+ title: Swagger Petstore
+ version: 1.0.0
+servers:
+- url: /
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ content: {}
+ 400:
+ description: Error
+ content:
+ 'application/json':
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+ content: {}
+components:
+ schemas:
+ response:
+ allOf:
+ - $ref: '#/components/schemas/standard_response'
+ properties:
+ data:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ standard_response:
+ type: object
+ properties:
+ result:
+ required:
+ - http_code
+ - status
+ - trace_id
+ type: object
+ properties:
+ status:
+ type: boolean
+ http_code:
+ type: integer
+ errors:
+ type: array
+ items:
+ required:
+ - code
+ - message
+ type: object
+ properties:
+ code:
+ type: integer
+ message:
+ type: string
+ trace_id:
+ type: string
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-r.json b/src/test/resources/checks/v32/schemas/OAR029/valid-r.json
new file mode 100644
index 00000000..d13c8e0f
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-r.json
@@ -0,0 +1,96 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/successResponseData"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "$ref": "#/components/responses/errorResponse"
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "successResponseData": {
+ "type": "object",
+ "properties": {
+ "payload": {
+ "type": "object",
+ "properties": {
+ "tipos": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "errorResponseData": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "string"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "httpStatus": {
+ "type": "integer"
+ }
+ },
+ "required": [
+ "code",
+ "message",
+ "httpStatus"
+ ]
+ }
+ }
+ }
+ },
+ "responses": {
+ "errorResponse": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/errorResponseData"
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid-r.yaml b/src/test/resources/checks/v32/schemas/OAR029/valid-r.yaml
new file mode 100644
index 00000000..574b0a26
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid-r.yaml
@@ -0,0 +1,59 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 200:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/successResponseData'
+ 204:
+ description: No content
+ 400:
+ $ref: '#/components/responses/errorResponse'
+ default:
+ description: Unknown
+components:
+ schemas:
+ successResponseData:
+ type: object
+ properties:
+ payload:
+ type: object
+ properties:
+ tipos:
+ type: array
+ items:
+ type: string
+ errorResponseData:
+ type: object
+ properties:
+ error:
+ type: object
+ properties:
+ code:
+ type: string
+ message:
+ type: string
+ details:
+ type: array
+ items:
+ type: string
+ httpStatus:
+ type: integer
+ required:
+ - code
+ - message
+ - httpStatus
+ responses:
+ errorResponse:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/errorResponseData'
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid.json b/src/test/resources/checks/v32/schemas/OAR029/valid.json
new file mode 100644
index 00000000..60f23a03
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid.json
@@ -0,0 +1,105 @@
+{
+ "openapi": "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/endpoint" : {
+ "get" : {
+ "responses" : {
+ "200" : {
+ "description" : "Ok",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204" : {
+ "description" : "No content"
+ },
+ "400" : {
+ "description" : "Error",
+ "content": {
+ "application/json": {
+ "schema" : {
+ "$ref" : "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default" : {
+ "description" : "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas" : {
+ "response" : {
+ "type" : "object",
+ "allOf" : [ {
+ "$ref" : "#/components/schemas/standard_response"
+ } ],
+ "properties" : {
+ "data" : {
+ "type" : "object",
+ "properties" : {
+ "tipos" : {
+ "type" : "array",
+ "items" : {
+ "type" : "string"
+ }
+ }
+ }
+ }
+ },
+ "required": [
+ "status",
+ "data"
+ ]
+ },
+ "standard_response" : {
+ "type" : "object",
+ "properties" : {
+ "status" : {
+ "type" : "object",
+ "properties" : {
+ "http_status" : {
+ "type" : "string"
+ },
+ "code" : {
+ "type" : "integer"
+ },
+ "errors" : {
+ "type" : "array",
+ "items" : {
+ "type" : "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "description" : {
+ "type" : "string"
+ },
+ "internal_code" : {
+ "type" : "string"
+ }
+ },
+ "required" : [ "http_status", "code", "description", "errors" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR029/valid.yaml b/src/test/resources/checks/v32/schemas/OAR029/valid.yaml
new file mode 100644
index 00000000..bc015a41
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR029/valid.yaml
@@ -0,0 +1,135 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.3
+ title: Swagger-Petstore_ab4bbf6031ef_V
+ license:
+ name: MIT
+servers:
+ - url: http://petstore.swagger.io/v1
+paths:
+ /pets:
+ get:
+ summary: List all pets
+ operationId: listPets
+ tags:
+ - pets
+ parameters:
+ - name: limit
+ in: query
+ description: How many items to return at one time (max 100).
+ required: false
+ schema:
+ type: integer
+ maximum: 100
+ format: int32
+ responses:
+ '200':
+ description: A paged array of pets
+ headers:
+ x-next:
+ description: A link to the next page of responses
+ schema:
+ type: string
+ content:
+ application/json:
+ schema:
+ $ref: >-
+ https://gitlab.com/api/v4/projects/55448121/repository/files/pet%2Eyaml/raw?private_token=glpat-Q7s_ciqer49cJB--sMFB#/Pets
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+ post:
+ summary: Create a pet
+ operationId: createPets
+ tags:
+ - pets
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ required: true
+ responses:
+ '201':
+ description: Null response
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+ /pets/{petId}:
+ get:
+ summary: Info for a specific pet
+ operationId: showPetById
+ tags:
+ - pets
+ parameters:
+ - name: petId
+ in: path
+ required: true
+ description: The id of the pet to retrieve
+ schema:
+ type: string
+ responses:
+ '200':
+ description: Expected response to a valid request
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Pet'
+ default:
+ description: unexpected error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Error'
+ x-microcks-operation:
+ delay: 100
+ dispatcher: SCRIPT
+ dispatcherRules: >-
+ def headers = mockRequest.getRequestHeaders(); if (headers.hasValues("X-Microcks-Response-Name")) { return headers.get("X-Microcks-Response-Name", "null") }
+components:
+ schemas:
+ Pet:
+ type: object
+ required:
+ - id
+ - name
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ tag:
+ type: string
+ Pets:
+ type: array
+ maxItems: 100
+ items:
+ $ref: '#/components/schemas/Pet'
+ Error:
+ type: object
+ required:
+ - code
+ - message
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
diff --git a/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.json b/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.json
new file mode 100644
index 00000000..83d29f55
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.json
@@ -0,0 +1,126 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "first": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "previous": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "next": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ },
+ "last": {
+ "allOf": [ {
+ "$ref": "#/components/schemas/link"
+ } ]
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.yaml b/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.yaml
new file mode 100644
index 00000000..4ac9e62d
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/valid-all-of.yaml
@@ -0,0 +1,84 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ first:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ previous:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ next:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ last:
+ allOf:
+ - $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/valid.json b/src/test/resources/checks/v32/schemas/OAR034/valid.json
new file mode 100644
index 00000000..42220085
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/valid.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/valid.yaml b/src/test/resources/checks/v32/schemas/OAR034/valid.yaml
new file mode 100644
index 00000000..9ce953bc
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/valid.yaml
@@ -0,0 +1,79 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.json b/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.json
new file mode 100644
index 00000000..8ca6ad31
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.json
@@ -0,0 +1,96 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": { # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.yaml b/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.yaml
new file mode 100644
index 00000000..f95e48fc
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-links-without-properties.yaml
@@ -0,0 +1,66 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links: # Noncompliant {{OAR034: 'first' property is missing}} {{OAR034: 'last' property is missing}} {{OAR034: 'next' property is missing}} {{OAR034: 'previous' property is missing}} {{OAR034: 'self' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.json b/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.json
new file mode 100644
index 00000000..abebc687
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.json
@@ -0,0 +1,91 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "string" # Noncompliant {{OAR034: 'start' must be of type integer}}
+ },
+ "limit": {
+ "type": "string" # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ },
+ "total": {
+ "type": "string" # Noncompliant {{OAR034: 'total' must be of type integer}}
+ },
+ "numPages": {
+ "type": "string" # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ },
+ "links": {
+ "type": "string", # Noncompliant {{OAR034: 'links' must be of type object}}
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.yaml b/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.yaml
new file mode 100644
index 00000000..78576885
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-with-properties-wrong-types.yaml
@@ -0,0 +1,63 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: string # Noncompliant {{OAR034: 'start' must be of type integer}}
+ limit:
+ type: string # Noncompliant {{OAR034: 'limit' must be of type integer}}
+ total:
+ type: string # Noncompliant {{OAR034: 'total' must be of type integer}}
+ numPages:
+ type: string # Noncompliant {{OAR034: 'numPages' must be of type integer}}
+ links:
+ type: string # Noncompliant {{OAR034: 'links' must be of type object}}
+ required:
+ - self
+ - previous
+ - next
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.json b/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.json
new file mode 100644
index 00000000..553117f2
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.json
@@ -0,0 +1,78 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": { # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.yaml b/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.yaml
new file mode 100644
index 00000000..cc402f14
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-without-properties.yaml
@@ -0,0 +1,51 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging: # Noncompliant {{OAR034: 'limit' property is missing}} {{OAR034: 'links' property is missing}} {{OAR034: 'numPages' property is missing}} {{OAR034: 'start' property is missing}} {{OAR034: 'total' property is missing}}
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.json b/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.json
new file mode 100644
index 00000000..72641c42
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.json
@@ -0,0 +1,73 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "string", # Noncompliant {{OAR034: 'paging' must be of type object}}
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.yaml b/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.yaml
new file mode 100644
index 00000000..fab5fa73
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/with-paging-wrong-type.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: string # Noncompliant {{OAR034: 'paging' must be of type object}}
+ required:
+ - start
+ - limit
+ - links
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.json b/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.json
new file mode 100644
index 00000000..3ca43d94
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self" ] # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ }
+ },
+ "required": [ "start", "limit", "links" ]
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.yaml b/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.yaml
new file mode 100644
index 00000000..944a6250
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-links-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required: # Noncompliant {{OAR034: The following fields must be required: next, previous, self}}
+ - self
+ required:
+ - start
+ - limit
+ - links
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.json b/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.json
new file mode 100644
index 00000000..e4341052
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.json
@@ -0,0 +1,116 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": {
+ "type": "object",
+ "allOf": [ {
+ "$ref": "#/components/schemas/paged_response"
+ } ],
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paged_response": {
+ "type": "object",
+ "properties": {
+ "paging": {
+ "type": "object",
+ "properties": {
+ "start": {
+ "type": "integer"
+ },
+ "limit": {
+ "type": "integer"
+ },
+ "total": {
+ "type": "integer"
+ },
+ "numPages": {
+ "type": "integer"
+ },
+ "links": {
+ "type": "object",
+ "properties": {
+ "self": {
+ "$ref": "#/components/schemas/link"
+ },
+ "first": {
+ "$ref": "#/components/schemas/link"
+ },
+ "previous": {
+ "$ref": "#/components/schemas/link"
+ },
+ "next": {
+ "$ref": "#/components/schemas/link"
+ },
+ "last": {
+ "$ref": "#/components/schemas/link"
+ }
+ },
+ "required": [ "self", "previous", "next" ]
+ }
+ },
+ "required": [ "start" ] # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ }
+ }
+ },
+ "link": {
+ "type": "object",
+ "properties": {
+ "href": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.yaml b/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.yaml
new file mode 100644
index 00000000..68bf3f34
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-pagination-required-fields.yaml
@@ -0,0 +1,77 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response:
+ type: object
+ allOf:
+ - $ref: '#/components/schemas/paged_response'
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
+ paged_response:
+ type: object
+ properties:
+ paging:
+ type: object
+ properties:
+ start:
+ type: integer
+ limit:
+ type: integer
+ total:
+ type: integer
+ numPages:
+ type: integer
+ links:
+ type: object
+ properties:
+ self:
+ $ref: '#/components/schemas/link'
+ first:
+ $ref: '#/components/schemas/link'
+ previous:
+ $ref: '#/components/schemas/link'
+ next:
+ $ref: '#/components/schemas/link'
+ last:
+ $ref: '#/components/schemas/link'
+ required:
+ - self
+ - previous
+ - next
+ required: # Noncompliant {{OAR034: The following fields must be required: limit, links, start}}
+ - start
+ link:
+ type: object
+ properties:
+ href:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-paging.json b/src/test/resources/checks/v32/schemas/OAR034/without-paging.json
new file mode 100644
index 00000000..4c4b6437
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-paging.json
@@ -0,0 +1,61 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/endpoint": {
+ "get": {
+ "responses": {
+ "206": {
+ "description": "Ok",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "204": {
+ "description": "No content"
+ },
+ "400": {
+ "description": "Error",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/response"
+ }
+ }
+ }
+ },
+ "default": {
+ "description": "Unknown"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "response": { # Noncompliant {{OAR034: 'paging' property is missing}}
+ "type": "object",
+ "properties": {
+ "data": {
+ "type": "object",
+ "properties": {
+ "values": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR034/without-paging.yaml b/src/test/resources/checks/v32/schemas/OAR034/without-paging.yaml
new file mode 100644
index 00000000..c0dbc57c
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR034/without-paging.yaml
@@ -0,0 +1,37 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /endpoint:
+ get:
+ responses:
+ 206:
+ description: Ok
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ 204:
+ description: No content
+ 400:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/response'
+ default:
+ description: Unknown
+
+components:
+ schemas:
+ response: # Noncompliant {{OAR034: 'paging' property is missing}}
+ type: object
+ properties:
+ data:
+ type: object
+ properties:
+ values:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.json b/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.json
new file mode 100644
index 00000000..8193dfa4
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.json
@@ -0,0 +1,20 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "security": [],
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.yaml b/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.yaml
new file mode 100644
index 00000000..53a97a51
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/empty-global-security.yaml
@@ -0,0 +1,12 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+security: []
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/schemas/OAR080/empty-security.json b/src/test/resources/checks/v32/schemas/OAR080/empty-security.json
new file mode 100644
index 00000000..671a98b0
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/empty-security.json
@@ -0,0 +1,31 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/schemas/OAR080/empty-security.yaml b/src/test/resources/checks/v32/schemas/OAR080/empty-security.yaml
new file mode 100644
index 00000000..b246d1f4
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/empty-security.yaml
@@ -0,0 +1,19 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security: []
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/schemas/OAR080/global-security.json b/src/test/resources/checks/v32/schemas/OAR080/global-security.json
new file mode 100644
index 00000000..aab7da02
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/global-security.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "security": [
+ { "apiKey": [] },
+ { "oauth2": [] }
+ ],
+ "components": {
+ "securitySchemes": {
+ "oauth2": {
+ "type": "oauth2",
+ "flows": {
+ "implicit": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "scopes": {
+ "read": "Read access"
+ }
+ }
+ }
+ },
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "summary": "Create a new product",
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/schemas/OAR080/global-security.yaml b/src/test/resources/checks/v32/schemas/OAR080/global-security.yaml
new file mode 100644
index 00000000..532b155a
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/global-security.yaml
@@ -0,0 +1,51 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+security:
+ - apiKey: []
+ - oauth2: []
+components:
+ securitySchemes:
+ oauth2:
+ type: oauth2
+ flows:
+ implicit:
+ authorizationUrl: https://example.com/oauth/authorize
+ scopes:
+ read: Read access
+ apiKey:
+ type: apiKey
+ name: X-API-Key
+ in: header
+paths:
+ /users:
+ get:
+ summary: Get all users
+ responses:
+ '200':
+ description: OK
+ /products:
+ post:
+ summary: Create a new product
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put:
+ summary: Update an order
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete:
+ summary: Delete an invoice
+ responses:
+ '200':
+ description: OK
+ /items:
+ patch:
+ summary: Patch an item
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/schemas/OAR080/with-security.json b/src/test/resources/checks/v32/schemas/OAR080/with-security.json
new file mode 100644
index 00000000..c0b8fe2c
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/with-security.json
@@ -0,0 +1,71 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "summary": "Get all users",
+ "security": [
+ {
+ "apiKey": [],
+ "oauth2": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "summary": "Create a new product",
+ "security": [
+ {
+ "oauth2": [],
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Update an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Delete an invoice",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR080/with-security.yaml b/src/test/resources/checks/v32/schemas/OAR080/with-security.yaml
new file mode 100644
index 00000000..99c44eb7
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/with-security.yaml
@@ -0,0 +1,39 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get:
+ summary: Get all users
+ security:
+ - apiKey: []
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post:
+ summary: Create a new product
+ security:
+ - apiKey: []
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Update an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Delete an invoice
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR080/without-security.json b/src/test/resources/checks/v32/schemas/OAR080/without-security.json
new file mode 100644
index 00000000..7e02041a
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/without-security.json
@@ -0,0 +1,69 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [
+ {
+ "oauth2": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Update an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Delete an invoice",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR080/without-security.yaml b/src/test/resources/checks/v32/schemas/OAR080/without-security.yaml
new file mode 100644
index 00000000..0ab16d33
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/without-security.yaml
@@ -0,0 +1,37 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security:
+ - apiKey: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security:
+ - oauth2: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ put: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Update an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /invoices:
+ delete: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Delete an invoice
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.json b/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.json
new file mode 100644
index 00000000..e20a76f3
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Get all users",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Create a new product",
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "patch": { # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ "summary": "Patch an order",
+ "security": [
+ {
+ "unknownScheme": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.yaml b/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.yaml
new file mode 100644
index 00000000..f047839b
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR080/wrong-scheme.yaml
@@ -0,0 +1,35 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+paths:
+ /users:
+ get: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Get all users
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Create a new product
+ security:
+ - apiKey: []
+ responses:
+ '200':
+ description: OK
+ /orders:
+ patch: # Noncompliant {{OAR080: The security scheme must be among those allowed by the organization and must be complete.}}
+ summary: Patch an order
+ security:
+ - unknownScheme: []
+ responses:
+ '200':
+ description: OK
+ /items:
+ head:
+ summary: Head – non-security verb, ignored
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/schemas/OAR108/invalid.json b/src/test/resources/checks/v32/schemas/OAR108/invalid.json
new file mode 100644
index 00000000..96a5d234
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR108/invalid.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Ejemplo de API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/item": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer"
+ },
+ "nombre": {
+ "type": "string"
+ }
+ },
+ "required": ["id", "nombre"]
+ },
+ "example": { # Noncompliant {{OAR108: Schema does not match the provided example}}
+ "id": "hola",
+ "nombre": "Ejemplo"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/src/test/resources/checks/v32/schemas/OAR108/invalid.yaml b/src/test/resources/checks/v32/schemas/OAR108/invalid.yaml
new file mode 100644
index 00000000..dccc1f8b
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR108/invalid.yaml
@@ -0,0 +1,25 @@
+ openapi: "3.2.0"
+ info:
+ title: Ejemplo de API
+ version: 1.0.0
+ paths:
+ /item:
+ get:
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ nombre:
+ type: string
+ required:
+ - id
+ - nombre
+ example: # Noncompliant {{OAR108: Schema does not match the provided example}}
+ id: hola123
+ nombre: Ejemplo
diff --git a/src/test/resources/checks/v32/schemas/OAR108/valid.json b/src/test/resources/checks/v32/schemas/OAR108/valid.json
new file mode 100644
index 00000000..53977b51
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR108/valid.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Ejemplo de API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/item": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number"
+ },
+ "nombre": {
+ "type": "string"
+ }
+ },
+ "required": ["id", "nombre"]
+ },
+ "example": {
+ "id": 12.3,
+ "nombre": "Ejemplo"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/src/test/resources/checks/v32/schemas/OAR108/valid.yaml b/src/test/resources/checks/v32/schemas/OAR108/valid.yaml
new file mode 100644
index 00000000..c2c1b929
--- /dev/null
+++ b/src/test/resources/checks/v32/schemas/OAR108/valid.yaml
@@ -0,0 +1,47 @@
+openapi: "3.2.0"
+info:
+ title: Ejemplo de API Ampliada
+ version: 1.0.0
+paths:
+ /item:
+ get:
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: number
+ nombre:
+ type: string
+ activo:
+ type: boolean
+ configuracion:
+ type: object
+ properties:
+ tema:
+ type: string
+ notificaciones:
+ type: boolean
+ tags:
+ type: array
+ items:
+ type: string
+ proyectoNull:
+ type: string
+ nullable: true
+ required:
+ - id
+ - nombre
+ example:
+ id: 123.0
+ nombre: Ejemplo
+ activo: false
+ configuracion:
+ tema: Oscuro
+ notificaciones: true
+ tags: ["api", "openapi"]
+ proyectoNull: null
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR001/with-servers.json b/src/test/resources/checks/v32/security/OAR001/with-servers.json
new file mode 100644
index 00000000..934be5ad
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR001/with-servers.json
@@ -0,0 +1,15 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "servers" : [
+ {
+ "url": "http://petstore.swagger.io/v1" # Noncompliant {{OAR001: Protocol https in server url is mandatory}}
+ }
+ ],
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR001/with-servers.yaml b/src/test/resources/checks/v32/security/OAR001/with-servers.yaml
new file mode 100644
index 00000000..0f37bb45
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR001/with-servers.yaml
@@ -0,0 +1,8 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: http://petstore.swagger.io/v1 # Noncompliant {{OAR001: Protocol https in server url is mandatory}}
+paths:
+ /pets: {}
diff --git a/src/test/resources/checks/v32/security/OAR001/without-servers.json b/src/test/resources/checks/v32/security/OAR001/without-servers.json
new file mode 100644
index 00000000..b90a9639
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR001/without-servers.json
@@ -0,0 +1,10 @@
+{ # Noncompliant {{OAR001: Define 'servers' is mandatory}}
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/pets" : { }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR001/without-servers.yaml b/src/test/resources/checks/v32/security/OAR001/without-servers.yaml
new file mode 100644
index 00000000..63401c50
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR001/without-servers.yaml
@@ -0,0 +1,7 @@
+# Noncompliant {{OAR001: Define 'servers' is mandatory}}
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets: {}
diff --git a/src/test/resources/checks/v32/security/OAR033/valid.json b/src/test/resources/checks/v32/security/OAR033/valid.json
new file mode 100644
index 00000000..4e4529b9
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/valid.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "header",
+ "name": "traceId",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "header",
+ "name": "dateTime",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ {
+ "in": "query",
+ "name": "Authorization",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR033/valid.yaml b/src/test/resources/checks/v32/security/OAR033/valid.yaml
new file mode 100644
index 00000000..5e9cbb6b
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/valid.yaml
@@ -0,0 +1,31 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /petts:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ - in: header
+ name: traceId
+ schema:
+ type: string
+ required: true
+ - in: header
+ name: dateTime
+ schema:
+ type: string
+ required: true
+ - in: query
+ name: Authorization
+ schema:
+ type: string
+ required: true
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.json b/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.json
new file mode 100644
index 00000000..ce8ecd49
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "x-api-key": {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ "accept": {
+ "in": "header",
+ "name": "Accept", # Noncompliant {{OAR033: Header not allowed}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/x-api-key"
+ },
+ {
+ "$ref": "#/components/parameters/accept"
+ },
+ {
+ "in": "header",
+ "name": "Authorization", # Noncompliant {{OAR033: Header not allowed}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.yaml b/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.yaml
new file mode 100644
index 00000000..f01a8cbe
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/with-forbidden-params.yaml
@@ -0,0 +1,32 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ x-api-key:
+ in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ accept:
+ in: header
+ name: Accept # Noncompliant {{OAR033: Header not allowed}}
+ schema:
+ type: string
+ required: true
+paths:
+ /pets:
+ get:
+ parameters:
+ - $ref: '#/components/parameters/x-api-key'
+ - $ref: '#/components/parameters/accept'
+ - in: header
+ name: Authorization # Noncompliant {{OAR033: Header not allowed}}
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR033/without-required-params.json b/src/test/resources/checks/v32/security/OAR033/without-required-params.json
new file mode 100644
index 00000000..08c3a340
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/without-required-params.json
@@ -0,0 +1,53 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "parameters": {
+ "x-api-key": {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ },
+ "traceId": {
+ "in": "header",
+ "name": "traceId",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [
+ {
+ "$ref": "#/components/parameters/traceId"
+ }
+ ],
+ "get": { # Noncompliant {{OAR033: Headers [x-api-key] are required}}
+ "parameters": [
+ {
+ "in": "header",
+ "name": "dateTime",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR033/without-required-params.yaml b/src/test/resources/checks/v32/security/OAR033/without-required-params.yaml
new file mode 100644
index 00000000..9fd19bbe
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR033/without-required-params.yaml
@@ -0,0 +1,32 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ parameters:
+ x-api-key:
+ in: header
+ name: x-api-key
+ schema:
+ type: string
+ required: true
+ traceId:
+ in: header
+ name: traceId
+ schema:
+ type: string
+ required: true
+paths:
+ /pets:
+ parameters:
+ - $ref: '#/components/parameters/traceId'
+ get: # Noncompliant {{OAR033: Headers [x-api-key] are required}}
+ parameters:
+ - in: header
+ name: dateTime
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR035/valid.json b/src/test/resources/checks/v32/security/OAR035/valid.json
new file mode 100644
index 00000000..afe22a84
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR035/valid.json
@@ -0,0 +1,117 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": [
+
+ ]
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "403": {
+ "description": "Forbidden"
+ },
+ "429": {
+ "description": "Forbidden"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "429": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR035/valid.yaml b/src/test/resources/checks/v32/security/OAR035/valid.yaml
new file mode 100644
index 00000000..1e29e338
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR035/valid.yaml
@@ -0,0 +1,70 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 403:
+ description: Forbidden
+ 429:
+ description: Forbidden
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 429:
+ description: Unauthorized
+ /without:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.json b/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.json
new file mode 100644
index 00000000..f2eaff61
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.json
@@ -0,0 +1,100 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": { # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.yaml b/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.yaml
new file mode 100644
index 00000000..d78a208a
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR035/without-authorization-responses.yaml
@@ -0,0 +1,62 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /without:
+ get:
+ responses: # Noncompliant {{OAR035: Response code 401 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR036/valid.json b/src/test/resources/checks/v32/security/OAR036/valid.json
new file mode 100644
index 00000000..abd690f0
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR036/valid.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "parameters": [ {
+ "in": "header",
+ "name": "X-Authorization",
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR036/valid.yaml b/src/test/resources/checks/v32/security/OAR036/valid.yaml
new file mode 100644
index 00000000..3cd82124
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR036/valid.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ parameters:
+ - in: header
+ name: X-Authorization
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR036/with-cookie.json b/src/test/resources/checks/v32/security/OAR036/with-cookie.json
new file mode 100644
index 00000000..913683bf
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR036/with-cookie.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "parameters": [ {
+ "in": "header",
+ "name": "Cookie", # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "get": {
+ "parameters": [ {
+ "in": "header",
+ "name": "Cookie", # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "required": true
+ } ],
+ "responses": {
+ "200": {
+ "description": "Ok",
+ "headers": {
+ "Set-Cookie": { # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ "schema": {
+ "type": "string"
+ },
+ "description": "session"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR036/with-cookie.yaml b/src/test/resources/checks/v32/security/OAR036/with-cookie.yaml
new file mode 100644
index 00000000..954d494d
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR036/with-cookie.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ parameters:
+ - in: header
+ name: Cookie # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ required: true
+ get:
+ parameters:
+ - in: header
+ name: Cookie # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ required: true
+ responses:
+ 200:
+ description: Ok
+ headers:
+ Set-Cookie: # Noncompliant {{OAR036: Cookie use is forbidden as a session mechanism}}
+ schema:
+ type: string
+ description: session
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR045/defined-response.json b/src/test/resources/checks/v32/security/OAR045/defined-response.json
new file mode 100644
index 00000000..b19ef64b
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR045/defined-response.json
@@ -0,0 +1,78 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "some response" // Noncompliant {{OAR045: Define the model of your response}}
+ },
+ "202": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "401": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "error response",
+ "$ref": "#/components/responses/MyErroneousResponse"
+ }
+ }
+ },
+ "post": {
+ "responses": {} // Noncompliant {{OAR045: Define the responses of your operations}}
+ },
+ "put": {
+ "responses": {
+ "default": {
+ "description": "default response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ },
+ "200": { // Noncompliant {{OAR045: Define the model of your response}}
+ "description": "success response"
+ }
+ }
+ }
+ },
+ "/other": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No content"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "responses": {
+ "MyErroneousResponse": {
+ "description": "an example response missing a model"
+ },
+ "MyOtherResponse": {
+ "description": "some response",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object"
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR045/defined-response.yaml b/src/test/resources/checks/v32/security/OAR045/defined-response.yaml
new file mode 100644
index 00000000..14f08cea
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR045/defined-response.yaml
@@ -0,0 +1,48 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /pets:
+ get:
+ responses:
+ # Noncompliant@+1 {{OAR045: Define the model of your response}}
+ '200':
+ description: some response
+ '202':
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: string
+ '401': # Noncompliant {{OAR045: Define the model of your response}}
+ description: error response
+ $ref: '#/components/responses/MyErroneousResponse'
+ post:
+ # Noncompliant@+1 {{OAR045: Define the responses of your operations}}
+ responses: {}
+ put:
+ responses:
+ default:
+ description: default response
+ content:
+ application/json:
+ schema:
+ type: object
+ '200': # Noncompliant {{OAR045: Define the model of your response}}
+ description: success response
+ /other:
+ delete:
+ responses:
+ '204':
+ description: No content
+components:
+ responses:
+ MyErroneousResponse:
+ description: an example response missing a model
+ MyOtherResponse:
+ description: some response
+ content:
+ application/json:
+ schema:
+ type: object
diff --git a/src/test/resources/checks/v32/security/OAR049/no-content-in-204.json b/src/test/resources/checks/v32/security/OAR049/no-content-in-204.json
new file mode 100644
index 00000000..a8697a7e
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR049/no-content-in-204.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/other-pets/{petId}" : {
+ "delete" : {
+ "responses" : {
+ "204" : { # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ "description" : "delete pet",
+ "content" : {
+ "application/json" : {
+ "schema" : {
+ "type" : "object"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR049/no-content-in-204.yaml b/src/test/resources/checks/v32/security/OAR049/no-content-in-204.yaml
new file mode 100644
index 00000000..9de0d682
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR049/no-content-in-204.yaml
@@ -0,0 +1,14 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /other-pets/{petId}:
+ delete:
+ responses:
+ '204': # Noncompliant {{OAR049: 204 No Content MUST NOT return anything}}
+ description: delete pet
+ content:
+ 'application/json':
+ schema:
+ type: object
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR053/excluded-code.json b/src/test/resources/checks/v32/security/OAR053/excluded-code.json
new file mode 100644
index 00000000..bab1a2ca
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/excluded-code.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "delete": {
+ "responses": {
+ "204": {
+ "description": "No Content"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR053/excluded-code.yaml b/src/test/resources/checks/v32/security/OAR053/excluded-code.yaml
new file mode 100644
index 00000000..80d58771
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/excluded-code.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ delete:
+ responses:
+ '204':
+ description: No Content
diff --git a/src/test/resources/checks/v32/security/OAR053/excluded-path.json b/src/test/resources/checks/v32/security/OAR053/excluded-path.json
new file mode 100644
index 00000000..1b2876b6
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/excluded-path.json
@@ -0,0 +1,18 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/status": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR053/excluded-path.yaml b/src/test/resources/checks/v32/security/OAR053/excluded-path.yaml
new file mode 100644
index 00000000..fd3408e3
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/excluded-path.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /status:
+ get:
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/security/OAR053/forbidden-header.json b/src/test/resources/checks/v32/security/OAR053/forbidden-header.json
new file mode 100644
index 00000000..0a084165
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/forbidden-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-forbidden-custom-header": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR053/forbidden-header.yaml b/src/test/resources/checks/v32/security/OAR053/forbidden-header.yaml
new file mode 100644
index 00000000..2da22886
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/forbidden-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ x-forbidden-custom-header:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v32/security/OAR053/missing-header.json b/src/test/resources/checks/v32/security/OAR053/missing-header.json
new file mode 100644
index 00000000..20259f73
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/missing-header.json
@@ -0,0 +1,25 @@
+{
+ "openapi": "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "idCorrelacion": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR053/missing-header.yaml b/src/test/resources/checks/v32/security/OAR053/missing-header.yaml
new file mode 100644
index 00000000..6e266fa3
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/missing-header.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ description: OK
+ headers:
+ idCorrelacion:
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v32/security/OAR053/valid.json b/src/test/resources/checks/v32/security/OAR053/valid.json
new file mode 100644
index 00000000..85a9f5ff
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/valid.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "responses": {
+ "PetsResponse": {
+ "description": "OK",
+ "headers": {
+ "x-trace-id": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/pets": {
+ "get": {
+ "responses": {
+ "200": {
+ "$ref": "#/components/responses/PetsResponse"
+ },
+ "400": {
+ "description": "Bad Request",
+ "headers": {
+ "x-trace-id": {
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR053/valid.yaml b/src/test/resources/checks/v32/security/OAR053/valid.yaml
new file mode 100644
index 00000000..a3b32904
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR053/valid.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+
+components:
+ responses:
+ PetsResponse:
+ description: OK
+ headers:
+ x-trace-id:
+ schema:
+ type: string
+
+paths:
+ /pets:
+ get:
+ responses:
+ '200':
+ $ref: '#/components/responses/PetsResponse'
+ '400':
+ description: Bad Request
+ headers:
+ x-trace-id:
+ schema:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR054/valid.json b/src/test/resources/checks/v32/security/OAR054/valid.json
new file mode 100644
index 00000000..a8b59154
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR054/valid.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "servers": [
+ {
+ "url": "https://api-dev.apiaddicts.org/api-vehicular/v1/"
+ },
+ {
+ "url": "https://api-test.apiaddicts.org/api-vehicular/v1/"
+ },
+ {
+ "url": "https://api.apiaddicts.org/api-vehicular/v1/"
+ }
+ ],
+ "paths": { }
+}
diff --git a/src/test/resources/checks/v32/security/OAR054/valid.yaml b/src/test/resources/checks/v32/security/OAR054/valid.yaml
new file mode 100644
index 00000000..ff09239f
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR054/valid.yaml
@@ -0,0 +1,9 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+servers:
+ - url: https://api-dev.apiaddicts.org/api-vehicular/v1/
+ - url: https://api-test.apiaddicts.org/api-vehicular/v1/
+ - url: https://api.apiaddicts.org/api-vehicular/v1/
+paths: {}
diff --git a/src/test/resources/checks/v32/security/OAR072/no-stack-trace.json b/src/test/resources/checks/v32/security/OAR072/no-stack-trace.json
new file mode 100644
index 00000000..5abbe93e
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR072/no-stack-trace.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Compliant API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "message": {
+ "type": "string",
+ "maxLength": 100
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad Request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "error": {
+ "type": "string",
+ "maxLength": 100
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR072/no-stack-trace.yaml b/src/test/resources/checks/v32/security/OAR072/no-stack-trace.yaml
new file mode 100644
index 00000000..ba476c40
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR072/no-stack-trace.yaml
@@ -0,0 +1,36 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '200':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ status:
+ type: string
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
+ details:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR072/with-stack-trace.json b/src/test/resources/checks/v32/security/OAR072/with-stack-trace.json
new file mode 100644
index 00000000..08854fef
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR072/with-stack-trace.json
@@ -0,0 +1,62 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/sample": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Successful operation",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "name": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ },
+ "400": {
+ "description": "Bad request",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "code": {
+ "type": "integer",
+ "format": "int32"
+ },
+ "message": {
+ "type": "string"
+ },
+ "details": {
+ "type": "string"
+ },
+ "stackTrace": { # Noncompliant {{OAR072: Non OK responses shouldnt have stackTraces}}
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR072/with-stack-trace.yaml b/src/test/resources/checks/v32/security/OAR072/with-stack-trace.yaml
new file mode 100644
index 00000000..ba0fa6f8
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR072/with-stack-trace.yaml
@@ -0,0 +1,40 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+paths:
+ /sample:
+ get:
+ responses:
+ '201':
+ description: Successful operation
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer
+ format: int64
+ name:
+ type: string
+ status:
+ type: string
+ stackTrace:
+ type: string
+ '400':
+ description: Bad request
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32
+ message:
+ type: string
+ details:
+ type: string
+ stackTrace: # Noncompliant {{OAR072: Non OK responses shouldnt have stackTraces}}
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR074/no-restrictions.json b/src/test/resources/checks/v32/security/OAR074/no-restrictions.json
new file mode 100644
index 00000000..30a2ca68
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR074/no-restrictions.json
@@ -0,0 +1,35 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "integer" # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "number" # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR074/no-restrictions.yaml b/src/test/resources/checks/v32/security/OAR074/no-restrictions.yaml
new file mode 100644
index 00000000..80f4e7ef
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR074/no-restrictions.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: integer # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ - name: param2
+ in: query
+ schema:
+ type: number # Noncompliant {{OAR074: Numeric parameters should have minimum, maximum, or format restriction}}
+ responses:
+ 200:
+ description: A list of items
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR074/with-restrictions.json b/src/test/resources/checks/v32/security/OAR074/with-restrictions.json
new file mode 100644
index 00000000..fef30980
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR074/with-restrictions.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "integer",
+ "minimum": 1,
+ "maximum": 100,
+ "format": "double"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "number",
+ "minimum": 1,
+ "maximum": 100
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR074/with-restrictions.yaml b/src/test/resources/checks/v32/security/OAR074/with-restrictions.yaml
new file mode 100644
index 00000000..b7693fe3
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR074/with-restrictions.yaml
@@ -0,0 +1,26 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: integer
+ minimum: 1
+ maximum: 100
+ format: double
+ - name: param2
+ in: query
+ schema:
+ type: number
+ minimum: 1
+ maximum: 100
+ format: double
+ responses:
+ 200:
+ description: A list of items
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR075/no-restrictions.json b/src/test/resources/checks/v32/security/OAR075/no-restrictions.json
new file mode 100644
index 00000000..b82d61c7
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR075/no-restrictions.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API sin restricciones",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string" # Noncompliant {{OAR075: String parameters should have minLength, maxLength, pattern (regular expression), or enum restriction that are defined in the properties}}
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Un usuario"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR075/no-restrictions.yaml b/src/test/resources/checks/v32/security/OAR075/no-restrictions.yaml
new file mode 100644
index 00000000..68d3cc96
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR075/no-restrictions.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ title: API sin restricciones
+ version: 1.0.0
+paths:
+ /users/{id}:
+ get:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string # Noncompliant {{OAR075: String parameters should have minLength, maxLength, pattern (regular expression), or enum restriction that are defined in the properties}}
+ responses:
+ '200':
+ description: Un usuario
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR075/with-restrictions.json b/src/test/resources/checks/v32/security/OAR075/with-restrictions.json
new file mode 100644
index 00000000..e432f96b
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR075/with-restrictions.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "API con restricciones",
+ "version": "1.0.0"
+ },
+ "paths": {
+ "/users/{id}": {
+ "get": {
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "minLength": 5,
+ "maxLength": 120,
+ "format": "date",
+ "enum": ["admin", "user", "guest"]
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Un usuario"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR075/with-restrictions.yaml b/src/test/resources/checks/v32/security/OAR075/with-restrictions.yaml
new file mode 100644
index 00000000..ef75a4ba
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR075/with-restrictions.yaml
@@ -0,0 +1,20 @@
+openapi: "3.2.0"
+info:
+ title: API con restricciones
+ version: 1.0.0
+paths:
+ /users/{id}:
+ get:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ minLength: 5
+ maxLength: 120
+ format: date
+ enum: ['admin', 'user', 'guest']
+ responses:
+ '200':
+ description: Un usuario
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR076/nested.json b/src/test/resources/checks/v32/security/OAR076/nested.json
new file mode 100644
index 00000000..e949f5da
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/nested.json
@@ -0,0 +1,40 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR076/nested.yaml b/src/test/resources/checks/v32/security/OAR076/nested.yaml
new file mode 100644
index 00000000..7d83c848
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/nested.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int64
+
diff --git a/src/test/resources/checks/v32/security/OAR076/plain.json b/src/test/resources/checks/v32/security/OAR076/plain.json
new file mode 100644
index 00000000..0fc18c99
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/plain.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "integer" # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ },
+ "product_id": {
+ "type": "integer", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int32"
+ },
+ "price": {
+ "type": "number",
+ "format": "double"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR076/plain.yaml b/src/test/resources/checks/v32/security/OAR076/plain.yaml
new file mode 100644
index 00000000..da61ff97
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/plain.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ id:
+ type: integer # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ product_id:
+ type: integer # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int128
+ line:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int32
+ price:
+ type: number
+ format: double
+
diff --git a/src/test/resources/checks/v32/security/OAR076/with-$ref.json b/src/test/resources/checks/v32/security/OAR076/with-$ref.json
new file mode 100644
index 00000000..498df227
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/with-$ref.json
@@ -0,0 +1,47 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "price": {
+ "type": "number",
+ "format": "double"
+ },
+ "nested": {
+ "$ref": "#/components/schemas/nested"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "nested": {
+ "type": "object",
+ "properties": {
+ "value": {
+ "type": "number", # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ "format": "int64"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR076/with-$ref.yaml b/src/test/resources/checks/v32/security/OAR076/with-$ref.yaml
new file mode 100644
index 00000000..44973e70
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR076/with-$ref.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ price:
+ type: number
+ format: double
+ nested:
+ $ref: '#/components/schemas/nested'
+
+components:
+ schemas:
+ nested:
+ type: object
+ properties:
+ value:
+ type: number # Noncompliant {{OAR076: Numeric types requires a valid format}}
+ format: int64
diff --git a/src/test/resources/checks/v32/security/OAR078/no-security.json b/src/test/resources/checks/v32/security/OAR078/no-security.json
new file mode 100644
index 00000000..6190e361
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR078/no-security.json
@@ -0,0 +1,54 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "components": {
+ "securitySchemes": {
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ },
+ "paths": {
+ "/users": {
+ "get": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": { # Noncompliant {{OAR078: All API methods must have security}}
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR078/no-security.yaml b/src/test/resources/checks/v32/security/OAR078/no-security.yaml
new file mode 100644
index 00000000..c9e96179
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR078/no-security.yaml
@@ -0,0 +1,33 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Sample API
+components:
+ securitySchemes:
+ apiKey:
+ type: apiKey
+ name: X-API-Key
+ in: header
+paths:
+ /users:
+ get: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+ /products:
+ post: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+
+ /orders:
+ put: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
+
+ /invoices:
+ delete: # Noncompliant {{OAR078: All API methods must have security}}
+ responses:
+ '200':
+ description: OK
diff --git a/src/test/resources/checks/v32/security/OAR078/with-security.json b/src/test/resources/checks/v32/security/OAR078/with-security.json
new file mode 100644
index 00000000..53583a35
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR078/with-security.json
@@ -0,0 +1,74 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Sample API"
+ },
+ "paths": {
+ "/users": {
+ "get": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/products": {
+ "post": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/orders": {
+ "put": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK"
+ }
+ }
+ }
+ },
+ "/invoices": {
+ "delete": {
+ "security": [
+ {
+ "apiKey": []
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "OK esto a json"
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "securitySchemes": {
+ "apiKey": {
+ "type": "apiKey",
+ "name": "X-API-Key",
+ "in": "header"
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR078/with-security.yaml b/src/test/resources/checks/v32/security/OAR078/with-security.yaml
new file mode 100644
index 00000000..6aab85d4
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR078/with-security.yaml
@@ -0,0 +1,49 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ version: 1.0.0
+servers:
+ - url: https://api.example.com/v1
+
+# Definición de seguridad global
+security:
+ - apiKeyHeader: []
+
+paths:
+ /items:
+ get: # Verb 'get' sin definición de seguridad local
+ summary: Get all items
+ responses:
+ '200':
+ description: Successful response
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: '#/components/schemas/Item'
+ post: # Verb 'post' sin definición de seguridad local
+ summary: Create an item
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/Item'
+ responses:
+ '201':
+ description: Item created
+
+components:
+ schemas:
+ Item:
+ type: object
+ properties:
+ id:
+ type: string
+ name:
+ type: string
+ securitySchemes:
+ apiKeyHeader:
+ type: apiKey
+ in: header
+ name: X-API-Key
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR079/bad-request404.json b/src/test/resources/checks/v32/security/OAR079/bad-request404.json
new file mode 100644
index 00000000..5f7c42b7
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/bad-request404.json
@@ -0,0 +1,42 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ },
+ "404": {
+ "description": "Bad Request"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR079/bad-request404.yaml b/src/test/resources/checks/v32/security/OAR079/bad-request404.yaml
new file mode 100644
index 00000000..57f8f4c2
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/bad-request404.yaml
@@ -0,0 +1,25 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
+ 404:
+ description: Bad Request
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR079/no-bad-request404.json b/src/test/resources/checks/v32/security/OAR079/no-bad-request404.json
new file mode 100644
index 00000000..82467638
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/no-bad-request404.json
@@ -0,0 +1,38 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths": {
+ "/example1": {
+ "get": {
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "path",
+ "required": false,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": { # Noncompliant {{OAR079: Paths parameters, should have not found (404) response}}
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR079/no-bad-request404.yaml b/src/test/resources/checks/v32/security/OAR079/no-bad-request404.yaml
new file mode 100644
index 00000000..50903fb1
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/no-bad-request404.yaml
@@ -0,0 +1,22 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /status:
+ get:
+ parameters:
+ - name: param1
+ in: path
+ required: false
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
diff --git a/src/test/resources/checks/v32/security/OAR079/no-parameters.json b/src/test/resources/checks/v32/security/OAR079/no-parameters.json
new file mode 100644
index 00000000..535baf45
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/no-parameters.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR079/no-parameters.yaml b/src/test/resources/checks/v32/security/OAR079/no-parameters.yaml
new file mode 100644
index 00000000..7017ea09
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v32/security/OAR079/query-param-only.json b/src/test/resources/checks/v32/security/OAR079/query-param-only.json
new file mode 100644
index 00000000..2138fa47
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/query-param-only.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR079/query-param-only.yaml b/src/test/resources/checks/v32/security/OAR079/query-param-only.yaml
new file mode 100644
index 00000000..d6865b7c
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR079/query-param-only.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v32/security/OAR081/.gitkeep b/src/test/resources/checks/v32/security/OAR081/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/src/test/resources/checks/v32/security/OAR081/not-valid-password.json b/src/test/resources/checks/v32/security/OAR081/not-valid-password.json
new file mode 100644
index 00000000..3ec58921
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/not-valid-password.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": { # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ "type": "string",
+ "format": "number"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR081/not-valid-password.yaml b/src/test/resources/checks/v32/security/OAR081/not-valid-password.yaml
new file mode 100644
index 00000000..05b349e0
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/not-valid-password.yaml
@@ -0,0 +1,31 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR081/valid-password.json b/src/test/resources/checks/v32/security/OAR081/valid-password.json
new file mode 100644
index 00000000..39f22784
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/valid-password.json
@@ -0,0 +1,52 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR081/valid-password.yaml b/src/test/resources/checks/v32/security/OAR081/valid-password.yaml
new file mode 100644
index 00000000..568a8c78
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/valid-password.yaml
@@ -0,0 +1,31 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password:
+ type: string
+ format: password
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ username:
+ type: string
+ password:
+ type: string
+ format: password
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR081/valid-with-components.json b/src/test/resources/checks/v32/security/OAR081/valid-with-components.json
new file mode 100644
index 00000000..517286df
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/valid-with-components.json
@@ -0,0 +1,50 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/users": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "A user was successfully created.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "$ref": "#/components/schemas/User"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "components": {
+ "schemas": {
+ "User": {
+ "type": "object",
+ "properties": {
+ "username": {
+ "type": "string"
+ },
+ "password": { # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ "type": "string",
+ "format": "number"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR081/valid-with-components.yaml b/src/test/resources/checks/v32/security/OAR081/valid-with-components.yaml
new file mode 100644
index 00000000..49e82667
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR081/valid-with-components.yaml
@@ -0,0 +1,29 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /users:
+ post:
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+ responses:
+ 200:
+ description: A user was successfully created.
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/User'
+components:
+ schemas:
+ User:
+ type: object
+ properties:
+ username:
+ type: string
+ password: # Noncompliant {{OAR081: Fields of type password should be string with format password}}
+ type: string
+ format: number
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR082/.gitkeep b/src/test/resources/checks/v32/security/OAR082/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/src/test/resources/checks/v32/security/OAR082/valid-format.json b/src/test/resources/checks/v32/security/OAR082/valid-format.json
new file mode 100644
index 00000000..9c00671e
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR082/valid-format.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "product": {
+ "type": "string", # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ "format": "int128"
+ },
+ "line": {
+ "type": "string" # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ },
+ "price": {
+ "type": "string",
+ "format": "byte"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR082/valid-format.yaml b/src/test/resources/checks/v32/security/OAR082/valid-format.yaml
new file mode 100644
index 00000000..6af346ba
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR082/valid-format.yaml
@@ -0,0 +1,23 @@
+openapi: "3.2.0"
+info:
+ version: "1.0.0"
+ title: "Swagger Petstore"
+paths:
+ /invoices:
+ get:
+ responses:
+ '200':
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ product:
+ type: string # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ format: int128
+ line:
+ type: string # Noncompliant {{OAR082: The string properties of the specified parameters must define a byte or binary format.}}
+ price:
+ type: string
+ format: byte
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.json b/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.json
new file mode 100644
index 00000000..402aa882
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [ # Noncompliant {{OAR083: The parameter email should not pass through this querystring}}
+ {
+ "name": "email",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "patata",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.yaml b/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.yaml
new file mode 100644
index 00000000..0cf5c0a7
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/forbidden-query-params.yaml
@@ -0,0 +1,26 @@
+ openapi: "3.2.0"
+ info:
+ version: 1.0.0
+ title: My API
+ paths:
+ /examples:
+ post:
+ summary: Get a list of items
+ parameters: # Noncompliant {{OAR083: The parameter email should not pass through this querystring}}
+ - name: email
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR083/no-parameters.json b/src/test/resources/checks/v32/security/OAR083/no-parameters.json
new file mode 100644
index 00000000..a705a344
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/no-parameters.json
@@ -0,0 +1,19 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": {
+ "description": "A list of items"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR083/no-parameters.yaml b/src/test/resources/checks/v32/security/OAR083/no-parameters.yaml
new file mode 100644
index 00000000..069cf9fe
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v32/security/OAR083/null-name-param.json b/src/test/resources/checks/v32/security/OAR083/null-name-param.json
new file mode 100644
index 00000000..619c7bfe
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/null-name-param.json
@@ -0,0 +1,30 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "summary": "Get an item",
+ "parameters": [
+ {
+ "name": null,
+ "in": "query",
+ "schema": { "type": "string" }
+ },
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": { "description": "An item" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR083/null-name-param.yaml b/src/test/resources/checks/v32/security/OAR083/null-name-param.yaml
new file mode 100644
index 00000000..561150ef
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/null-name-param.yaml
@@ -0,0 +1,21 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples/{id}:
+ get:
+ summary: Get an item
+ parameters:
+ - name: ~
+ in: query
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ responses:
+ 200:
+ description: An item
diff --git a/src/test/resources/checks/v32/security/OAR083/options-operation.json b/src/test/resources/checks/v32/security/OAR083/options-operation.json
new file mode 100644
index 00000000..f5cb7ef2
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/options-operation.json
@@ -0,0 +1,24 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "options": {
+ "summary": "Options for the resource",
+ "parameters": [
+ {
+ "name": "email",
+ "in": "query",
+ "schema": { "type": "string" }
+ }
+ ],
+ "responses": {
+ "200": { "description": "OK" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR083/options-operation.yaml b/src/test/resources/checks/v32/security/OAR083/options-operation.yaml
new file mode 100644
index 00000000..47c08a6f
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/options-operation.yaml
@@ -0,0 +1,16 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ options:
+ summary: Options for the resource
+ parameters:
+ - name: email
+ in: query
+ schema:
+ type: string
+ responses:
+ 200:
+ description: OK
diff --git a/src/test/resources/checks/v32/security/OAR083/valid-query-params.json b/src/test/resources/checks/v32/security/OAR083/valid-query-params.json
new file mode 100644
index 00000000..19c72c9a
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/valid-query-params.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR083/valid-query-params.yaml b/src/test/resources/checks/v32/security/OAR083/valid-query-params.yaml
new file mode 100644
index 00000000..b197d0e1
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR083/valid-query-params.yaml
@@ -0,0 +1,26 @@
+ openapi: "3.2.0"
+ info:
+ version: 1.0.0
+ title: My API
+ paths:
+ /items:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: param1
+ in: query
+ schema:
+ type: string
+ - name: param2
+ in: query
+ schema:
+ type: integer
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.json b/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.json
new file mode 100644
index 00000000..1cd4b749
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.json
@@ -0,0 +1,46 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "exampleParam1",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": "password" # Noncompliant {{OAR084: The format password should not pass through this querystring}}
+ }
+ },
+ {
+ "name": "param3",
+ "in": "query",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.yaml b/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.yaml
new file mode 100644
index 00000000..4a59d181
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/forbidden-query-formats.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: password # Noncompliant {{OAR084: The format password should not pass through this querystring}}
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR084/no-parameters.json b/src/test/resources/checks/v32/security/OAR084/no-parameters.json
new file mode 100644
index 00000000..30c27d40
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/no-parameters.json
@@ -0,0 +1,17 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "responses": {
+ "200": { "description": "A list of items" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR084/no-parameters.yaml b/src/test/resources/checks/v32/security/OAR084/no-parameters.yaml
new file mode 100644
index 00000000..069cf9fe
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/no-parameters.yaml
@@ -0,0 +1,11 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v32/security/OAR084/non-query-param.json b/src/test/resources/checks/v32/security/OAR084/non-query-param.json
new file mode 100644
index 00000000..d4e1d97d
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/non-query-param.json
@@ -0,0 +1,28 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples/{id}": {
+ "get": {
+ "summary": "Get an item",
+ "parameters": [
+ {
+ "name": "id",
+ "in": "path",
+ "required": true,
+ "schema": {
+ "type": "string",
+ "format": "password"
+ }
+ }
+ ],
+ "responses": {
+ "200": { "description": "An item" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR084/non-query-param.yaml b/src/test/resources/checks/v32/security/OAR084/non-query-param.yaml
new file mode 100644
index 00000000..2dcaec30
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/non-query-param.yaml
@@ -0,0 +1,18 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples/{id}:
+ get:
+ summary: Get an item
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ format: password
+ responses:
+ 200:
+ description: An item
diff --git a/src/test/resources/checks/v32/security/OAR084/null-format-param.json b/src/test/resources/checks/v32/security/OAR084/null-format-param.json
new file mode 100644
index 00000000..13a53849
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/null-format-param.json
@@ -0,0 +1,27 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/examples": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "exampleParam1",
+ "in": "query",
+ "schema": {
+ "type": "string",
+ "format": null
+ }
+ }
+ ],
+ "responses": {
+ "200": { "description": "A list of items" }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR084/null-format-param.yaml b/src/test/resources/checks/v32/security/OAR084/null-format-param.yaml
new file mode 100644
index 00000000..ba804e6a
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/null-format-param.yaml
@@ -0,0 +1,17 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: ~
+ responses:
+ 200:
+ description: A list of items
diff --git a/src/test/resources/checks/v32/security/OAR084/valid-query-formats.json b/src/test/resources/checks/v32/security/OAR084/valid-query-formats.json
new file mode 100644
index 00000000..19c72c9a
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/valid-query-formats.json
@@ -0,0 +1,45 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "My API"
+ },
+ "paths": {
+ "/items": {
+ "get": {
+ "summary": "Get a list of items",
+ "parameters": [
+ {
+ "name": "param1",
+ "in": "query",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "name": "param2",
+ "in": "query",
+ "schema": {
+ "type": "integer"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "A list of items",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR084/valid-query-formats.yaml b/src/test/resources/checks/v32/security/OAR084/valid-query-formats.yaml
new file mode 100644
index 00000000..93194d88
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR084/valid-query-formats.yaml
@@ -0,0 +1,27 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: My API
+paths:
+ /examples:
+ get:
+ summary: Get a list of items
+ parameters:
+ - name: exampleParam1
+ in: query
+ schema:
+ type: string
+ format: date
+ - name: param3
+ in: query
+ schema:
+ type: boolean
+ responses:
+ 200:
+ description: A list of items
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ type: string
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.json b/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.json
new file mode 100644
index 00000000..256544c0
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.yaml b/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.yaml
new file mode 100644
index 00000000..ad5d7aab
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/invalid-openapi-version.yaml
@@ -0,0 +1,6 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ description: This is a sample API.
+ version: 1.0.0
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR085/truly-invalid.json b/src/test/resources/checks/v32/security/OAR085/truly-invalid.json
new file mode 100644
index 00000000..e7637d72
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/truly-invalid.json
@@ -0,0 +1,9 @@
+{
+ "openapi": "4.0.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API with an invalid openapi version.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+}
diff --git a/src/test/resources/checks/v32/security/OAR085/truly-invalid.yaml b/src/test/resources/checks/v32/security/OAR085/truly-invalid.yaml
new file mode 100644
index 00000000..d9dbb374
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/truly-invalid.yaml
@@ -0,0 +1,6 @@
+openapi: "4.0.0"
+info:
+ title: Sample API
+ description: This is a sample API with an invalid openapi version.
+ version: 1.0.0
+paths: {}
diff --git a/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.json b/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.json
new file mode 100644
index 00000000..f752e79a
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.json
@@ -0,0 +1,9 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Sample API",
+ "description": "This is a sample API.",
+ "version": "1.0.0"
+ },
+ "paths": {}
+ }
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.yaml b/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.yaml
new file mode 100644
index 00000000..ad5d7aab
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR085/valid-openapi-version.yaml
@@ -0,0 +1,6 @@
+openapi: "3.2.0"
+info:
+ title: Sample API
+ description: This is a sample API.
+ version: 1.0.0
+paths: {}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR096/valid.json b/src/test/resources/checks/v32/security/OAR096/valid.json
new file mode 100644
index 00000000..afe22a84
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR096/valid.json
@@ -0,0 +1,117 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": [
+
+ ]
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "403": {
+ "description": "Forbidden"
+ },
+ "429": {
+ "description": "Forbidden"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ },
+ "401": {
+ "description": "Unauthorized"
+ },
+ "429": {
+ "description": "Unauthorized"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR096/valid.yaml b/src/test/resources/checks/v32/security/OAR096/valid.yaml
new file mode 100644
index 00000000..1e29e338
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR096/valid.yaml
@@ -0,0 +1,70 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 403:
+ description: Forbidden
+ 429:
+ description: Forbidden
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses:
+ 200:
+ description: Ok
+ 401:
+ description: Unauthorized
+ 429:
+ description: Unauthorized
+ /without:
+ get:
+ responses:
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.json b/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.json
new file mode 100644
index 00000000..dfc5b706
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.json
@@ -0,0 +1,100 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "components": {
+ "securitySchemes": {
+ "BasicAuth": {
+ "type": "http",
+ "scheme": "basic"
+ },
+ "BearerAuth": {
+ "type": "http",
+ "scheme": "bearer"
+ },
+ "ApiKeyAuth": {
+ "type": "apiKey",
+ "in": "header",
+ "name": "X-API-Key"
+ },
+ "OpenID": {
+ "type": "openIdConnect",
+ "openIdConnectUrl": "https://example.com/.well-known/openid-configuration"
+ },
+ "OAuth2": {
+ "type": "oauth2",
+ "flows": {
+ "authorizationCode": {
+ "authorizationUrl": "https://example.com/oauth/authorize",
+ "tokenUrl": "https://example.com/oauth/token",
+ "scopes": {
+ "read": "Grants read access",
+ "write": "Grants write access",
+ "admin": "Grants access to admin operations"
+ }
+ }
+ }
+ }
+ }
+ },
+ "paths": {
+ "/with-auth-and-header": {
+ "get": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "security": [
+ {
+ "ApiKeyAuth": []
+ },
+ {
+ "OAuth2": [
+ "read",
+ "write"
+ ]
+ }
+ ],
+ "responses": { # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/with-header": {
+ "parameters": [
+ {
+ "in": "header",
+ "name": "x-api-key",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ },
+ "/without": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "Ok"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.yaml b/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.yaml
new file mode 100644
index 00000000..654f0e76
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR096/without-authorization-responses.yaml
@@ -0,0 +1,62 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+components:
+ securitySchemes:
+ BasicAuth:
+ type: http
+ scheme: basic
+ BearerAuth:
+ type: http
+ scheme: bearer
+ ApiKeyAuth:
+ type: apiKey
+ in: header
+ name: X-API-Key
+ OpenID:
+ type: openIdConnect
+ openIdConnectUrl: https://example.com/.well-known/openid-configuration
+ OAuth2:
+ type: oauth2
+ flows:
+ authorizationCode:
+ authorizationUrl: https://example.com/oauth/authorize
+ tokenUrl: https://example.com/oauth/token
+ scopes:
+ read: Grants read access
+ write: Grants write access
+ admin: Grants access to admin operations
+security:
+ - ApiKeyAuth: []
+ - OAuth2:
+ - read
+ - write
+paths:
+ /with-auth-and-header:
+ get:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /with-header:
+ parameters:
+ - in: header
+ name: x-api-key
+ schema:
+ type: string
+ get:
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
+
+ /without:
+ get:
+ responses: # Noncompliant {{OAR096: Response code 403 must be defined for operations with security schemes defined}}
+ 200:
+ description: Ok
\ No newline at end of file
diff --git a/src/test/resources/checks/v32/security/OAR114/valid.json b/src/test/resources/checks/v32/security/OAR114/valid.json
new file mode 100644
index 00000000..9e4f6f6e
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/valid.json
@@ -0,0 +1,32 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Valid Response Headers Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "OK",
+ "headers": {
+ "x-api-key": {
+ "description": "Mandatory header",
+ "schema": {
+ "type": "string"
+ }
+ },
+ "traceId": {
+ "description": "Optional but allowed",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR114/valid.yaml b/src/test/resources/checks/v32/security/OAR114/valid.yaml
new file mode 100644
index 00000000..d45749e5
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/valid.yaml
@@ -0,0 +1,19 @@
+openapi: "3.2.0"
+info:
+ title: Valid Response Headers Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200":
+ description: OK
+ headers:
+ x-api-key:
+ description: Mandatory header
+ schema:
+ type: string
+ traceId:
+ description: Optional but allowed
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.json b/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.json
new file mode 100644
index 00000000..403e73dc
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Forbidden Header Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ "description": "OK",
+ "headers": {
+ "Authorization": { # Noncompliant {{OAR114: Header not allowed}}
+ "description": "Forbidden header",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.yaml b/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.yaml
new file mode 100644
index 00000000..0d9f1f35
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/with-forbidden-params.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ title: Forbidden Header Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200": # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ description: OK
+ headers:
+ Authorization: # Noncompliant {{OAR114: Header not allowed}}
+ description: Forbidden header
+ schema:
+ type: string
diff --git a/src/test/resources/checks/v32/security/OAR114/without-required-params.json b/src/test/resources/checks/v32/security/OAR114/without-required-params.json
new file mode 100644
index 00000000..daec8dcc
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/without-required-params.json
@@ -0,0 +1,26 @@
+{
+ "openapi" : "3.2.0",
+ "info": {
+ "title": "Missing Mandatory Header Test",
+ "version": "1.0"
+ },
+ "paths": {
+ "/example": {
+ "get": {
+ "responses": {
+ "200": { # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ "description": "OK",
+ "headers": {
+ "traceId": {
+ "description": "Allowed header",
+ "schema": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/security/OAR114/without-required-params.yaml b/src/test/resources/checks/v32/security/OAR114/without-required-params.yaml
new file mode 100644
index 00000000..06a30abd
--- /dev/null
+++ b/src/test/resources/checks/v32/security/OAR114/without-required-params.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ title: Missing Mandatory Header Test
+ version: "1.0"
+paths:
+ /example:
+ get:
+ responses:
+ "200": # Noncompliant {{OAR114: Headers [x-api-key] are required}}
+ description: OK
+ headers:
+ traceId:
+ description: Allowed header
+ schema:
+ type: string
diff --git a/src/test/resources/validation-test-all-violations.yaml b/src/test/resources/validation-test-all-violations.yaml
new file mode 100644
index 00000000..a4ec2f75
--- /dev/null
+++ b/src/test/resources/validation-test-all-violations.yaml
@@ -0,0 +1,110 @@
+openapi: 3.0.0
+info:
+ title: Test API with Violations
+ version: 1.0.0
+ # Missing license and contact (OAR110, OAR111)
+servers:
+ - url: http://example.com # OAR001: Should be HTTPS
+ description: Non-HTTPS server
+paths:
+ /users:
+ get:
+ summary: Get Users
+ # Missing description (OAR086, OAR087)
+ operationId: getUsers
+ tags:
+ - undeclaredTag # OAR046: Tag not in global tags list
+ parameters:
+ - name: limit
+ in: query
+ schema:
+ type: integer
+ # Missing required field info (OAR025)
+ - name: offset_value # OAR077: Should use snake_case in query params
+ in: query
+ schema:
+ type: integer
+ required: true
+ responses:
+ '200':
+ description: Success
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ '401':
+ # Missing content for non-204 response (OAR045)
+ description: Unauthorized
+ '204':
+ description: No Content
+ # OAR049: Should not have content for 204
+ content:
+ application/json:
+ schema:
+ type: object
+ post:
+ summary: Create User
+ description: This creates a user # OAR051: Summary and description are too similar
+ requestBody:
+ # Missing content (OAR006)
+ required: true
+ responses:
+ '201':
+ # Missing location header (OAR027)
+ description: Created
+ /products/{id}:
+ parameters:
+ - name: id
+ in: path
+ required: true
+ schema:
+ type: string
+ get:
+ summary: Get Product
+ parameters:
+ - name: id
+ in: query # OAR069: Path param should not also be in query
+ required: true
+ schema:
+ type: string
+ responses:
+ default:
+ description: Default
+ # Missing content (OAR007)
+ put:
+ summary: Update Product
+ responses:
+ '200':
+ description: Updated
+ # Missing content (OAR007)
+ /internal/admin: # OAR030: Status endpoint not found
+ get:
+ summary: Admin Panel
+ tags:
+ - admin
+ responses:
+ '200':
+ description: OK
+ content:
+ application/json:
+ schema:
+ type: object
+tags:
+ - name: users
+ description: User operations
+ - name: products
+ # OAR047: Tag should have description (if declared, should be used properly)
+components:
+ schemas:
+ Error:
+ type: object
+ properties:
+ code:
+ type: integer
+ format: int32 # OAR016, OAR037: Format validation
+ message:
+ type: string
+ # Missing required fields (OAR115)