{
- "swagger": "2.0",
+ "swagger": "2.0",
"info": {
- "version": "1.0.0",
+ "version": "1.0.0",
"title": "Swagger Petstore"
- },
+ },
"produces": [
- "application/json",
- "text/plain"
- ],
+ "application/json",
+ "text/plain",
+ "application/vnd.ms-excel",
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
+ "application/ld+json"
+ ],
"consumes": [
- "application/json",
- "text/plain"
- ],
+ "application/json",
+ "text/plain",
+ "application/vnd.ms-excel"
+ ],
"paths": {
"/pets": {
"get": {
"produces": [
- "application/json",
+ "application/json",
"text/plain"
- ],
+ ],
"consumes": [
- "application/json",
+ "application/json",
"text/plain"
- ],
- "responses": {
+ ],
+ "responses": {
"200": {
"description": "some operation"
}
@@ -108,9 +112,13 @@ YAML
produces:
- application/json
- text/plain
+ - application/vnd.ms-excel
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+ - application/ld+json
consumes:
- application/json
- text/plain
+ - application/vnd.ms-excel
paths:
/pets:
get:
@@ -128,24 +136,28 @@ Ejemplo de código no compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "version": "1.0.0",
+ "version": "1.0.0",
"title": "Swagger Petstore"
- },
+ },
"paths": {
- "/pets": null,
- "post": {
- "requestBody": null,
- "content": {
- "application": {},
- "text/*": {}
- },
- "responses": null,
- "200": {
- "description": "some operation",
- "content": null,
- "application": {}
+ "/pets": {
+ "post": {
+ "requestBody": {
+ "content": {
+ "application": {},
+ "invalid-no-slash": {}
+ }
+ },
+ "responses": {
+ "200": {
+ "description": "some operation",
+ "content": {
+ "application": {}
+ }
+ }
+ }
}
}
}
@@ -163,7 +175,7 @@ YAML
requestBody:
content:
'application': {}
- 'text/*': {}
+ 'invalid-no-slash': {}
responses:
'200':
description: some operation
@@ -174,25 +186,35 @@ Solución compatible (OpenAPI 3)
JSON
{
- "openapi": "3.0.1",
+ "openapi": "3.0.1",
"info": {
- "version": "1.0.0",
+ "version": "1.0.0",
"title": "Swagger Petstore"
- },
+ },
"paths": {
"/pets": {
"post": {
- "requestBody": {
+ "requestBody": {
"content": {
- "application/json": {},
- "text/plain": {}
+ "application/json": {},
+ "multipart/form-data": {},
+ "application/vnd.ms-excel": {},
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {},
+ "application/ld+json": {},
+ "image/*": {},
+ "*/*": {}
}
},
"responses": {
"200": {
- "description": "some operation",
+ "description": "some operation",
"content": {
- "application/json": {}
+ "application/json": {},
+ "text/csv": {},
+ "image/png": {},
+ "text/plain; charset=utf-8": {},
+ "application/vnd.ms-excel": {},
+ "application/vnd.github+json": {}
}
}
}
@@ -213,10 +235,20 @@ YAML
requestBody:
content:
'application/json': {}
- 'text/plain': {}
+ 'multipart/form-data': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
'200':
description: some operation
content:
'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'text/plain; charset=utf-8': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.github+json': {}
\ No newline at end of file
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 7f3e14a0..ce3e0344 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,5 +1,10 @@
-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.
+Una propiedad de tipo string sin un format reconocido y sin un pattern válido puede permitir la entrada de valores arbitrarios sin validar, lo que puede llevar a implementaciones inseguras o incorrectas de la API.
+Esta regla exige que todo schema de tipo string restrinja sus valores de una de estas dos formas:
+format con un valor reconocido, oformat, declarando un campo pattern que sea una expresión regular no vacía y sintácticamente válida.La regla dispara cuando format está presente pero no es reconocido, o cuando format está ausente y pattern está ausente, vacío, o no es una expresión regular sintácticamente válida.
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).
/a/b) o dos parámetros de ruta (p.ej. /{a}/{b})./{id}/items).Configurable: exclude_patterns (por defecto: get,me,search) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
Configurable: exclude_patterns (por defecto: get,me,search,delete) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
swagger: "2.0" diff --git a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR022.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR022.html index 93c17629..f0b86367 100644 --- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR022.html +++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR022.html @@ -1,4 +1,5 @@El parámetro elegido debe definirse en esta operación. Por defecto, $orderby
+Esta regla se aplica únicamente a endpoints GET de colección. Los paths que terminan con un parámetro de ruta (p. ej.
/examples/{id}) se consideran endpoints de recurso único y quedan excluidos automáticamente.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/OAR025.html b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR025.html index 235d4f29..84e5d1bc 100644 --- a/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR025.html +++ b/src/main/resources/org/sonar/l10n/es/openapi/rules/openapi/parameters/OAR025.html @@ -1,4 +1,5 @@El parámetro elegido debe definirse en esta operación. Por defecto, $limit
+Esta regla se aplica únicamente a endpoints GET de colección. Los paths que terminan con un parámetro de ruta (p. ej.
/examples/{id}) se consideran endpoints de recurso único y quedan excluidos automáticamente.Ejemplo de código no compatible (OpenAPI 2)
swagger: "2.0" 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 b8177471..b3884acb 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 @@ -4,7 +4,7 @@
/a/b) o dos parámetros de ruta (p.ej. /{a}/{b})./{id}/items).Configurable: exclude_patterns (por defecto: get,me,search) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
Configurable: exclude_patterns (por defecto: get,me,search,delete) — segmentos tratados como pseudo-parámetros que no rompen la regla de alternación.
diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/core/OAR044.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/core/OAR044.html index 07ab977f..202b2e9a 100644 --- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/core/OAR044.html +++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/core/OAR044.html @@ -65,30 +65,34 @@Compliant Solution (OpenAPI 2)
JSON
{ - "swagger": "2.0", + "swagger": "2.0", "info": { - "version": "1.0.0", + "version": "1.0.0", "title": "Swagger Petstore" - }, + }, "produces": [ - "application/json", - "text/plain" - ], + "application/json", + "text/plain", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/ld+json" + ], "consumes": [ - "application/json", - "text/plain" - ], + "application/json", + "text/plain", + "application/vnd.ms-excel" + ], "paths": { "/pets": { "get": { "produces": [ - "application/json", + "application/json", "text/plain" - ], + ], "consumes": [ - "application/json", + "application/json", "text/plain" - ], + ], "responses": { "200": { "description": "some operation" @@ -108,9 +112,13 @@YAML
produces: - application/json - text/plain + - application/vnd.ms-excel + - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet + - application/ld+json consumes: - application/json - text/plain + - application/vnd.ms-excel paths: /pets: get: @@ -128,24 +136,28 @@Noncompliant Code Example (OpenAPI 3)
JSON
{ - "openapi": "3.0.1", + "openapi": "3.0.1", "info": { - "version": "1.0.0", + "version": "1.0.0", "title": "Swagger Petstore" - }, + }, "paths": { - "/pets": null, - "post": { - "requestBody": null, - "content": { - "application": {}, - "text/*": {} - }, - "responses": null, - "200": { - "description": "some operation", - "content": null, - "application": {} + "/pets": { + "post": { + "requestBody": { + "content": { + "application": {}, + "invalid-no-slash": {} + } + }, + "responses": { + "200": { + "description": "some operation", + "content": { + "application": {} + } + } + } } } } @@ -163,7 +175,7 @@YAML
requestBody: content: 'application': {} - 'text/*': {} + 'invalid-no-slash': {} responses: '200': description: some operation @@ -174,25 +186,35 @@Compliant Solution (OpenAPI 3)
JSON
{ - "openapi": "3.0.1", + "openapi": "3.0.1", "info": { - "version": "1.0.0", + "version": "1.0.0", "title": "Swagger Petstore" - }, + }, "paths": { "/pets": { "post": { "requestBody": { "content": { - "application/json": {}, - "text/plain": {} + "application/json": {}, + "multipart/form-data": {}, + "application/vnd.ms-excel": {}, + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {}, + "application/ld+json": {}, + "image/*": {}, + "*/*": {} } - }, - "responses": { + }, + "responses": { "200": { - "description": "some operation", + "description": "some operation", "content": { - "application/json": {} + "application/json": {}, + "text/csv": {}, + "image/png": {}, + "text/plain; charset=utf-8": {}, + "application/vnd.ms-excel": {}, + "application/vnd.github+json": {} } } } @@ -213,10 +235,20 @@\ No newline at end of file diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/examples/OAR031.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/examples/OAR031.html index 78956b46..c20f54bc 100644 --- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/examples/OAR031.html +++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/examples/OAR031.html @@ -1,4 +1,6 @@YAML
requestBody: content: 'application/json': {} - 'text/plain': {} + 'multipart/form-data': {} + 'application/vnd.ms-excel': {} + 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {} + 'application/ld+json': {} + 'image/*': {} + '*/*': {} responses: '200': description: some operation content: 'application/json': {} + 'text/csv': {} + 'image/png': {} + 'text/plain; charset=utf-8': {} + 'application/vnd.ms-excel': {} + 'application/vnd.github+json': {}The examples can help developers to understand the response data structure and representation.
+Examples are validated as four independent levels: response, request body, parameter and property. The response, request-body and parameter levels require an example declared at the media-type or schema root; examples nested inside individual properties do not satisfy them.
+204responses are excluded.Each level can be enabled or disabled independently with the rule parameters
validate-response,validate-request-body,validate-parameterandvalidate-property(all enabled by default).Noncompliant Code Example (OpenAPI 2)
swagger: "2.0" 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 2ec09784..64fe2c3c 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,5 +1,10 @@ -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
+formatfield is absent or present but not recognized. Every string schema must declare one of the valid formats.A string schema without a recognized
+formatand without a validpatternmay allow arbitrary, unvalidated input, which can lead developers to use the wrong variable types or to accept unsafe values in the API implementation.This rule requires every string schema to constrain its values in one of two ways:
+
format field with a recognized value, orformat is declared, declare a pattern field that is a non-empty, syntactically valid regular expression.The rule fires when format is present but not recognized, or when format is absent and pattern is missing, empty, or not a syntactically valid regular expression.
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).
/a/b) or two path parameters (e.g. /{a}/{b})./{id}/items).Configurable: exclude_patterns (default: get,me,search) — segments treated as pseudo-parameters that do not break the alternation rule.
Configurable: exclude_patterns (default: get,me,search,delete) — segments treated as pseudo-parameters that do not break the alternation rule.
swagger: "2.0" diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR022.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR022.html index 5917921e..2d816f82 100644 --- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR022.html +++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR022.html @@ -1,4 +1,5 @@The chosen parameter must be defined in this operation. By default, $orderby
+This rule applies only to collection GET endpoints. Paths ending with a path parameter (e.g.
/examples/{id}) are treated as single-resource endpoints and are automatically excluded.Noncompliant Code Example (OpenAPI 2)
swagger: "2.0" diff --git a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR025.html b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR025.html index d896113f..40d0873f 100644 --- a/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR025.html +++ b/src/main/resources/org/sonar/l10n/openapi/rules/openapi/parameters/OAR025.html @@ -1,4 +1,5 @@The chosen parameter must be defined in this operation. By default, $limit
+This rule applies only to collection GET endpoints. Paths ending with a path parameter (e.g.
/examples/{id}) are treated as single-resource endpoints and are automatically excluded.Noncompliant Code Example (OpenAPI 2)
swagger: "2.0" 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 b33a7d6b..378a93fe 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 @@ -4,7 +4,7 @@
/a/b) or two path parameters (e.g. /{a}/{b})./{id}/items).Configurable: exclude_patterns (default: get,me,search) — segments treated as pseudo-parameters that do not break the alternation rule.
Configurable: exclude_patterns (default: get,me,search,delete) — segments treated as pseudo-parameters that do not break the alternation rule.
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 5cea16f8..4f7f624d 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/examples/OAR031ExamplesCheckTest.java
@@ -4,6 +4,7 @@
import org.junit.Test;
import org.sonar.api.rule.Severity;
import org.sonar.api.rules.RuleType;
+import org.sonar.api.server.rule.RuleParamType;
import apiaddicts.sonar.openapi.BaseCheckTest;
public class OAR031ExamplesCheckTest extends BaseCheckTest {
@@ -112,4 +113,13 @@ public void verifyRule() {
assertRuleProperties("OAR031 - Examples - Responses, Request Body, Parameters and Properties must have an example defined", RuleType.BUG, Severity.MAJOR, tags("examples"));
}
+ @Override
+ public void verifyParameters() {
+ assertNumberOfParameters(4);
+ assertParameterProperties("validateResponse", "true", RuleParamType.BOOLEAN);
+ assertParameterProperties("validateRequestBody", "true", RuleParamType.BOOLEAN);
+ assertParameterProperties("validateParameter", "true", RuleParamType.BOOLEAN);
+ assertParameterProperties("validateProperty", "true", RuleParamType.BOOLEAN);
+ }
+
}
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 ad561e9b..fb04f56a 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/format/OAR037StringFormatCheckTest.java
@@ -70,6 +70,11 @@ public void verifyInV2BlankFormat() {
verifyV2("blank-format");
}
+ @Test
+ public void verifyInV3PatternFallback() {
+ verifyV3("no-format");
+ }
+
@Override
public void verifyParameters() {
assertNumberOfParameters(1);
@@ -78,6 +83,6 @@ public void verifyParameters() {
@Override
public void verifyRule() {
- assertRuleProperties("OAR037 - StringFormat - String types requires a valid format", RuleType.BUG, Severity.MAJOR, tags("format"));
+ assertRuleProperties("OAR037 - StringFormat - String types require a valid format or pattern", RuleType.VULNERABILITY, Severity.MAJOR, tags("safety"));
}
}
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 88614748..54d9b77c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/operations/OAR017ResourcePathCheckTest.java
@@ -69,7 +69,7 @@ public void verifyRule() {
@Override
public void verifyParameters() {
assertNumberOfParameters(1);
- assertParameterProperties("exclude_patterns", "get,me,search", RuleParamType.STRING);
+ assertParameterProperties("exclude_patterns", "get,me,search,delete", RuleParamType.STRING);
}
}
\ No newline at end of file
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 49359130..87631f99 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR019SelectParameterCheckTest.java
@@ -117,8 +117,9 @@ public void verifyRule() {
@Override
public void verifyParameters() {
- assertNumberOfParameters(2);
- assertParameterProperties("paths", "/examples", RuleParamType.STRING);
- assertParameterProperties("pathValidationStrategy", "/include", RuleParamType.STRING);
+ assertNumberOfParameters(3);
+ assertParameterProperties("parameterName", "$select", RuleParamType.STRING);
+ assertParameterProperties("paths", "/me,/health,/ping,/status", RuleParamType.STRING);
+ assertParameterProperties("pathValidationStrategy", "/exclude", RuleParamType.STRING);
}
}
\ No newline at end of file
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 ceea3c8f..1be17b22 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR020ExpandParameterCheckTest.java
@@ -41,7 +41,7 @@ public void verifyInV2WithRef() {
@Test
public void verifyInV2PathEndingWithParam() {
- verifyV3("with-param");
+ verifyV2("with-param");
}
@Test
@@ -150,8 +150,9 @@ public void verifyRule() {
@Override
public void verifyParameters() {
- assertNumberOfParameters(2);
- assertParameterProperties("paths", "/examples", RuleParamType.STRING);
- assertParameterProperties("pathValidationStrategy", "/include", RuleParamType.STRING);
+ assertNumberOfParameters(3);
+ assertParameterProperties("parameterName", "$expand", RuleParamType.STRING);
+ assertParameterProperties("paths", "/me,/health,/ping,/status", RuleParamType.STRING);
+ assertParameterProperties("pathValidationStrategy", "/exclude", RuleParamType.STRING);
}
}
\ No newline at end of file
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 6cce39f9..da09cb4a 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR021ExcludeParameterCheckTest.java
@@ -41,7 +41,7 @@ public void verifyInV2WithRef() {
@Test
public void verifyInV2PathEndingWithParam() {
- verifyV3("with-param");
+ verifyV2("with-param");
}
@Test
@@ -150,8 +150,9 @@ public void verifyRule() {
@Override
public void verifyParameters() {
- assertNumberOfParameters(2);
- assertParameterProperties("paths", "/examples", RuleParamType.STRING);
- assertParameterProperties("pathValidationStrategy", "/include", RuleParamType.STRING);
+ assertNumberOfParameters(3);
+ assertParameterProperties("parameterName", "$exclude", RuleParamType.STRING);
+ assertParameterProperties("paths", "/me,/health,/ping,/status", RuleParamType.STRING);
+ assertParameterProperties("pathValidationStrategy", "/exclude", RuleParamType.STRING);
}
}
\ No newline at end of file
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 e7fccdb3..89c741be 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR022OrderbyParameterCheckTest.java
@@ -72,6 +72,23 @@ public void verifyInV32Without() {
verifyV32("plain-without");
}
+ @Test
+ public void verifyInV2SingleResource() {
+ verifyV2("single-resource");
+ }
+ @Test
+ public void verifyInV3SingleResource() {
+ verifyV3("single-resource");
+ }
+ @Test
+ public void verifyInV31SingleResource() {
+ verifyV31("single-resource");
+ }
+ @Test
+ public void verifyInV32SingleResource() {
+ verifyV32("single-resource");
+ }
+
@Override
public void verifyRule() {
assertRuleProperties("OAR022 - OrderbyParameter - the chosen parameter must be defined in this operation", RuleType.BUG, Severity.MINOR, tags("parameters"));
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 e6562b9d..463dfe8c 100644
--- a/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java
+++ b/src/test/java/apiaddicts/sonar/openapi/checks/parameters/OAR025LimitParameterCheckTest.java
@@ -72,6 +72,23 @@ public void verifyInV32Without() {
verifyV32("plain-without");
}
+ @Test
+ public void verifyInV2SingleResource() {
+ verifyV2("single-resource");
+ }
+ @Test
+ public void verifyInV3SingleResource() {
+ verifyV3("single-resource");
+ }
+ @Test
+ public void verifyInV31SingleResource() {
+ verifyV31("single-resource");
+ }
+ @Test
+ public void verifyInV32SingleResource() {
+ verifyV32("single-resource");
+ }
+
@Override
public void verifyRule() {
assertRuleProperties("OAR025 - LimitParameter - the chosen parameter must be defined in this operation", RuleType.BUG, Severity.MAJOR, tags("parameters"));
diff --git a/src/test/resources/checks/v2/core/OAR044/media-type.json b/src/test/resources/checks/v2/core/OAR044/media-type.json
index fb0e81ab..216fca4c 100644
--- a/src/test/resources/checks/v2/core/OAR044/media-type.json
+++ b/src/test/resources/checks/v2/core/OAR044/media-type.json
@@ -18,6 +18,8 @@
}
},
"post" : {
+ "produces" : [ "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/ld+json", "text/csv", "image/png" ],
+ "consumes" : [ "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/ld+json" ],
"responses" : {
"200" : {
"description" : "some operation"
diff --git a/src/test/resources/checks/v2/core/OAR044/media-type.yaml b/src/test/resources/checks/v2/core/OAR044/media-type.yaml
index 7a3a4849..fd2d08e0 100644
--- a/src/test/resources/checks/v2/core/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v2/core/OAR044/media-type.yaml
@@ -20,7 +20,17 @@ paths:
responses:
'200':
description: some operation
- post: # without produces/consumes -> should not fail
+ post:
+ produces:
+ - application/vnd.ms-excel
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+ - application/ld+json
+ - text/csv
+ - image/png
+ consumes:
+ - application/vnd.ms-excel
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+ - application/ld+json
responses:
'200':
description: some operation
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/examples/OAR031/externalref.yaml b/src/test/resources/checks/v2/examples/OAR031/externalref.yaml
index 8b2b3bc2..18b488c1 100644
--- a/src/test/resources/checks/v2/examples/OAR031/externalref.yaml
+++ b/src/test/resources/checks/v2/examples/OAR031/externalref.yaml
@@ -10,7 +10,7 @@ paths:
/users:
get:
responses:
- 200:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: OK
schema:
type: array
@@ -27,7 +27,7 @@ paths:
required: true
type: string
responses:
- 200:
+ 200: # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A single user
schema:
$ref: '#/definitions/User'
diff --git a/src/test/resources/checks/v2/examples/OAR031/nested-properties-examples.yaml b/src/test/resources/checks/v2/examples/OAR031/nested-properties-examples.yaml
index 13ca46e6..6b0b4816 100644
--- a/src/test/resources/checks/v2/examples/OAR031/nested-properties-examples.yaml
+++ b/src/test/resources/checks/v2/examples/OAR031/nested-properties-examples.yaml
@@ -6,7 +6,7 @@ paths:
/profile:
put:
parameters:
- - name: body
+ - name: body # Noncompliant {{OAR031: Parameters must have one or more examples defined}}
in: body
required: true
schema:
diff --git a/src/test/resources/checks/v2/examples/OAR031/valid.yaml b/src/test/resources/checks/v2/examples/OAR031/valid.yaml
index abb84e89..299650c1 100644
--- a/src/test/resources/checks/v2/examples/OAR031/valid.yaml
+++ b/src/test/resources/checks/v2/examples/OAR031/valid.yaml
@@ -12,6 +12,12 @@ paths:
description: Pet list
schema:
$ref: '#/definitions/pets'
+ examples:
+ application/json:
+ size: 1
+ pets:
+ - name: Snow
+ type: dog
default:
$ref: "#/responses/server_error_response"
/pets/{id}:
@@ -23,6 +29,10 @@ paths:
description: One pet
schema:
$ref: "#/definitions/pet"
+ examples:
+ application/json:
+ name: Snow
+ type: dog
default:
$ref: "#/responses/server_error_response"
@@ -63,4 +73,7 @@ responses:
properties:
error:
type: string
- example: "Server error"
\ No newline at end of file
+ example: "Server error"
+ examples:
+ application/json:
+ error: "Server error"
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/format/OAR037/nested.json b/src/test/resources/checks/v2/format/OAR037/nested.json
index 18663f0b..819ad8b7 100644
--- a/src/test/resources/checks/v2/format/OAR037/nested.json
+++ b/src/test/resources/checks/v2/format/OAR037/nested.json
@@ -17,8 +17,12 @@
"type" : "object",
"properties" : {
"value" : {
- "type" : "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type" : "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format" : "YYYY-MM-DD"
+ },
+ "code" : {
+ "type" : "string",
+ "pattern" : "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v2/format/OAR037/nested.yaml b/src/test/resources/checks/v2/format/OAR037/nested.yaml
index 4ad7fd36..6a3c55c2 100644
--- a/src/test/resources/checks/v2/format/OAR037/nested.yaml
+++ b/src/test/resources/checks/v2/format/OAR037/nested.yaml
@@ -15,6 +15,9 @@ paths:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v2/format/OAR037/plain.json b/src/test/resources/checks/v2/format/OAR037/plain.json
index 038c38a3..31df3943 100644
--- a/src/test/resources/checks/v2/format/OAR037/plain.json
+++ b/src/test/resources/checks/v2/format/OAR037/plain.json
@@ -14,7 +14,15 @@
"type" : "object",
"properties" : {
"without" : {
- "type" : "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ "type" : "string" # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ },
+ "withPattern" : {
+ "type" : "string",
+ "pattern" : "^[A-Z]{3}-[0-9]+$"
+ },
+ "withInvalidPattern" : {
+ "type" : "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern" : "["
},
"date" : {
"type" : "string",
@@ -61,7 +69,7 @@
"format" : "ipv6"
},
"other" : {
- "type" : "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type" : "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format" : "YYYY-MM-DD"
}
}
diff --git a/src/test/resources/checks/v2/format/OAR037/plain.yaml b/src/test/resources/checks/v2/format/OAR037/plain.yaml
index 957f5bc1..a09e36e2 100644
--- a/src/test/resources/checks/v2/format/OAR037/plain.yaml
+++ b/src/test/resources/checks/v2/format/OAR037/plain.yaml
@@ -12,7 +12,13 @@ paths:
type: object
properties:
without:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ withPattern:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
+ withInvalidPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: '['
date:
type: string
format: date
@@ -53,5 +59,5 @@ paths:
type: string
format: HEX(16)
other:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v2/format/OAR037/with-$ref.json b/src/test/resources/checks/v2/format/OAR037/with-$ref.json
index 5d9329d7..e9c50847 100644
--- a/src/test/resources/checks/v2/format/OAR037/with-$ref.json
+++ b/src/test/resources/checks/v2/format/OAR037/with-$ref.json
@@ -32,8 +32,12 @@
"type" : "object",
"properties" : {
"value" : {
- "type" : "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type" : "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format" : "YYYY-MM-DD"
+ },
+ "code" : {
+ "type" : "string",
+ "pattern" : "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v2/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v2/format/OAR037/with-$ref.yaml
index 3fea1aa9..a589efeb 100644
--- a/src/test/resources/checks/v2/format/OAR037/with-$ref.yaml
+++ b/src/test/resources/checks/v2/format/OAR037/with-$ref.yaml
@@ -22,5 +22,8 @@ definitions:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v2/format/OAR044/media-type.json b/src/test/resources/checks/v2/format/OAR044/media-type.json
index fb0e81ab..216fca4c 100644
--- a/src/test/resources/checks/v2/format/OAR044/media-type.json
+++ b/src/test/resources/checks/v2/format/OAR044/media-type.json
@@ -18,6 +18,8 @@
}
},
"post" : {
+ "produces" : [ "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/ld+json", "text/csv", "image/png" ],
+ "consumes" : [ "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/ld+json" ],
"responses" : {
"200" : {
"description" : "some operation"
diff --git a/src/test/resources/checks/v2/format/OAR044/media-type.yaml b/src/test/resources/checks/v2/format/OAR044/media-type.yaml
index 7a3a4849..fd2d08e0 100644
--- a/src/test/resources/checks/v2/format/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v2/format/OAR044/media-type.yaml
@@ -20,7 +20,17 @@ paths:
responses:
'200':
description: some operation
- post: # without produces/consumes -> should not fail
+ post:
+ produces:
+ - application/vnd.ms-excel
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+ - application/ld+json
+ - text/csv
+ - image/png
+ consumes:
+ - application/vnd.ms-excel
+ - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
+ - application/ld+json
responses:
'200':
description: some operation
\ No newline at end of file
diff --git a/src/test/resources/checks/v2/operations/OAR014/plain.json b/src/test/resources/checks/v2/operations/OAR014/plain.json
index 7561c445..1dc0ee29 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": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six": {
"get": {
"responses": {
"default": {
@@ -104,7 +104,7 @@
}
}
},
- "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}": { # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ "/one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}": {
"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 abae063e..5647b610 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: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six: # depth 6, out of the 4-5 non-suggested range (covered separately by OAR015)
get:
responses:
default:
description: Ok
- /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}: # Noncompliant {{OAR014: Resources depth level should be smaller}}
+ /one/{one}/two/{two}/three/{three}/four/{four}/five/{five}/six/{six}:
get:
responses:
default:
diff --git a/src/test/resources/checks/v2/operations/OAR017/plain.yaml b/src/test/resources/checks/v2/operations/OAR017/plain.yaml
index 81d61480..249e07ea 100644
--- a/src/test/resources/checks/v2/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v2/operations/OAR017/plain.yaml
@@ -43,6 +43,11 @@ paths:
responses:
200:
description: "Ok"
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: "Ok"
/one/{two}/{three}: # Noncompliant {{OAR017: Resource path should alternate static and parametrized parts}}
get:
responses:
diff --git a/src/test/resources/checks/v2/parameters/OAR022/single-resource.json b/src/test/resources/checks/v2/parameters/OAR022/single-resource.json
new file mode 100644
index 00000000..3357f145
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR022/single-resource.json
@@ -0,0 +1,23 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "type" : "string"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR022/single-resource.yaml b/src/test/resources/checks/v2/parameters/OAR022/single-resource.yaml
new file mode 100644
index 00000000..ae452772
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR022/single-resource.yaml
@@ -0,0 +1,14 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v2/parameters/OAR025/single-resource.json b/src/test/resources/checks/v2/parameters/OAR025/single-resource.json
new file mode 100644
index 00000000..3357f145
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR025/single-resource.json
@@ -0,0 +1,23 @@
+{
+ "swagger" : "2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "type" : "string"
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v2/parameters/OAR025/single-resource.yaml b/src/test/resources/checks/v2/parameters/OAR025/single-resource.yaml
new file mode 100644
index 00000000..ae452772
--- /dev/null
+++ b/src/test/resources/checks/v2/parameters/OAR025/single-resource.yaml
@@ -0,0 +1,14 @@
+swagger: "2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ type: string
+ responses:
+ 206:
+ 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 2a16af5a..08562325 100644
--- a/src/test/resources/checks/v2/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v2/resources/OAR017/plain.yaml
@@ -61,3 +61,9 @@ paths:
responses:
200:
description: Ok
+
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v3/core/OAR044/media-type.json b/src/test/resources/checks/v3/core/OAR044/media-type.json
index 992ea7bd..d954dc15 100644
--- a/src/test/resources/checks/v3/core/OAR044/media-type.json
+++ b/src/test/resources/checks/v3/core/OAR044/media-type.json
@@ -34,9 +34,27 @@
} ]
},
"post" : {
+ "requestBody" : {
+ "content" : {
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
+ }
+ },
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v3/core/OAR044/media-type.yaml b/src/test/resources/checks/v3/core/OAR044/media-type.yaml
index 80aba718..3b6ac527 100644
--- a/src/test/resources/checks/v3/core/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v3/core/OAR044/media-type.yaml
@@ -24,6 +24,21 @@ paths:
- name: otherParam
in: path
post:
+ requestBody:
+ content:
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v3/examples/OAR031/externalref.yaml b/src/test/resources/checks/v3/examples/OAR031/externalref.yaml
index 05e57ddb..e747a397 100644
--- a/src/test/resources/checks/v3/examples/OAR031/externalref.yaml
+++ b/src/test/resources/checks/v3/examples/OAR031/externalref.yaml
@@ -14,7 +14,7 @@ paths:
summary: Get all users
description: Returns a list of users.
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A JSON array of user objects
content:
application/json:
@@ -40,7 +40,7 @@ paths:
name: Puppy
type: dog
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A single user object
content:
application/json:
diff --git a/src/test/resources/checks/v3/examples/OAR031/nested-properties-examples.yaml b/src/test/resources/checks/v3/examples/OAR031/nested-properties-examples.yaml
index d80344b0..9a67dda1 100644
--- a/src/test/resources/checks/v3/examples/OAR031/nested-properties-examples.yaml
+++ b/src/test/resources/checks/v3/examples/OAR031/nested-properties-examples.yaml
@@ -6,7 +6,7 @@ paths:
/profile:
put:
summary: Update user profile
- requestBody:
+ requestBody: # Noncompliant {{OAR031: Request body must have one or more examples defined}}
required: true
content:
application/json:
diff --git a/src/test/resources/checks/v3/format/OAR037/complete.json b/src/test/resources/checks/v3/format/OAR037/complete.json
index b9e6416d..7c6f894f 100644
--- a/src/test/resources/checks/v3/format/OAR037/complete.json
+++ b/src/test/resources/checks/v3/format/OAR037/complete.json
@@ -10,7 +10,7 @@
"in": "header",
"name": "paramOne",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
},
@@ -18,7 +18,7 @@
"in": "header",
"name": "paramTwo",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -34,7 +34,7 @@
"in": "header",
"name": "paramThree",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -54,7 +54,15 @@
"type": "object",
"properties": {
"without": {
- "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string" # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ },
+ "withPattern": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
+ },
+ "withInvalidPattern": {
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern": "["
},
"date": {
"type": "string",
@@ -101,7 +109,7 @@
"format": "ipv6"
},
"other": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
diff --git a/src/test/resources/checks/v3/format/OAR037/complete.yaml b/src/test/resources/checks/v3/format/OAR037/complete.yaml
index 2120e544..0008a528 100644
--- a/src/test/resources/checks/v3/format/OAR037/complete.yaml
+++ b/src/test/resources/checks/v3/format/OAR037/complete.yaml
@@ -8,13 +8,13 @@ components:
in: header
name: paramOne
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paramTwo:
in: header
name: paramTwo
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paths:
/invoices:
@@ -23,7 +23,7 @@ paths:
- in: header
name: paramThree
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
get:
parameters:
@@ -37,7 +37,13 @@ paths:
type: object
properties:
without:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ withPattern:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
+ withInvalidPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: '['
date:
type: string
format: date
@@ -72,5 +78,5 @@ paths:
type: string
format: ipv6
other:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
diff --git a/src/test/resources/checks/v3/format/OAR037/nested.json b/src/test/resources/checks/v3/format/OAR037/nested.json
index 4b6316e6..5f6a71dc 100644
--- a/src/test/resources/checks/v3/format/OAR037/nested.json
+++ b/src/test/resources/checks/v3/format/OAR037/nested.json
@@ -19,8 +19,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v3/format/OAR037/nested.yaml b/src/test/resources/checks/v3/format/OAR037/nested.yaml
index e2ba0a91..9a0465f1 100644
--- a/src/test/resources/checks/v3/format/OAR037/nested.yaml
+++ b/src/test/resources/checks/v3/format/OAR037/nested.yaml
@@ -17,6 +17,9 @@ paths:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v3/format/OAR037/no-format.json b/src/test/resources/checks/v3/format/OAR037/no-format.json
new file mode 100644
index 00000000..57a1dd0f
--- /dev/null
+++ b/src/test/resources/checks/v3/format/OAR037/no-format.json
@@ -0,0 +1,42 @@
+{
+ "openapi": "3.0.0",
+ "info": {
+ "version": "1.0.0",
+ "title": "Swagger Petstore"
+ },
+ "paths": {
+ "/invoices": {
+ "get": {
+ "responses": {
+ "200": {
+ "description": "A invoice.",
+ "content": {
+ "application/json": {
+ "schema": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[A-Za-z ]+$"
+ },
+ "emptyPattern": {
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern": ""
+ },
+ "invalidPattern": {
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern": "[a-z"
+ },
+ "code": {
+ "type": "string" # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/format/OAR037/no-format.yaml b/src/test/resources/checks/v3/format/OAR037/no-format.yaml
new file mode 100644
index 00000000..ec4f21f1
--- /dev/null
+++ b/src/test/resources/checks/v3/format/OAR037/no-format.yaml
@@ -0,0 +1,26 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /invoices:
+ get:
+ responses:
+ 200:
+ description: A invoice.
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ name:
+ type: string
+ pattern: '^[A-Za-z ]+$'
+ emptyPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: ""
+ invalidPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: "[a-z"
+ code:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
diff --git a/src/test/resources/checks/v3/format/OAR037/with-$ref.json b/src/test/resources/checks/v3/format/OAR037/with-$ref.json
index 5707bfcb..51e70ff3 100644
--- a/src/test/resources/checks/v3/format/OAR037/with-$ref.json
+++ b/src/test/resources/checks/v3/format/OAR037/with-$ref.json
@@ -37,8 +37,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v3/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v3/format/OAR037/with-$ref.yaml
index c7d2f1f4..fbe316a5 100644
--- a/src/test/resources/checks/v3/format/OAR037/with-$ref.yaml
+++ b/src/test/resources/checks/v3/format/OAR037/with-$ref.yaml
@@ -25,5 +25,8 @@ components:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v3/format/OAR044/media-type.json b/src/test/resources/checks/v3/format/OAR044/media-type.json
index 89bd88b8..3d3b5d7a 100644
--- a/src/test/resources/checks/v3/format/OAR044/media-type.json
+++ b/src/test/resources/checks/v3/format/OAR044/media-type.json
@@ -32,12 +32,26 @@
"requestBody" : {
"content" : {
"application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
- "text/*" : { }
+ "text/*" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
}
},
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v3/format/OAR044/media-type.yaml b/src/test/resources/checks/v3/format/OAR044/media-type.yaml
index 46ffdc20..60d8c85a 100644
--- a/src/test/resources/checks/v3/format/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v3/format/OAR044/media-type.yaml
@@ -23,6 +23,19 @@ paths:
content:
'application': { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
'text/*': { }
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v3/operations/OAR017/plain.yaml b/src/test/resources/checks/v3/operations/OAR017/plain.yaml
index d902e89e..298bd9f9 100644
--- a/src/test/resources/checks/v3/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v3/operations/OAR017/plain.yaml
@@ -43,3 +43,8 @@ paths:
responses:
200:
description: Ok
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR019/excluded.yaml b/src/test/resources/checks/v3/parameters/OAR019/excluded.yaml
index 7758deac..5bb25ac8 100644
--- a/src/test/resources/checks/v3/parameters/OAR019/excluded.yaml
+++ b/src/test/resources/checks/v3/parameters/OAR019/excluded.yaml
@@ -3,7 +3,7 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /another:
+ /status:
get:
parameters:
- in: query
diff --git a/src/test/resources/checks/v3/parameters/OAR022/single-resource.json b/src/test/resources/checks/v3/parameters/OAR022/single-resource.json
new file mode 100644
index 00000000..54255ba9
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR022/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR022/single-resource.yaml b/src/test/resources/checks/v3/parameters/OAR022/single-resource.yaml
new file mode 100644
index 00000000..e76282c7
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR022/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v3/parameters/OAR025/single-resource.json b/src/test/resources/checks/v3/parameters/OAR025/single-resource.json
new file mode 100644
index 00000000..54255ba9
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR025/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.0.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v3/parameters/OAR025/single-resource.yaml b/src/test/resources/checks/v3/parameters/OAR025/single-resource.yaml
new file mode 100644
index 00000000..e76282c7
--- /dev/null
+++ b/src/test/resources/checks/v3/parameters/OAR025/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.0.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ 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 f872fa73..189c4d50 100644
--- a/src/test/resources/checks/v3/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v3/resources/OAR017/plain.yaml
@@ -56,3 +56,8 @@ paths:
responses:
200:
description: Ok
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/core/OAR044/media-type.json b/src/test/resources/checks/v31/core/OAR044/media-type.json
index 938aab91..2200bfd1 100644
--- a/src/test/resources/checks/v31/core/OAR044/media-type.json
+++ b/src/test/resources/checks/v31/core/OAR044/media-type.json
@@ -34,9 +34,27 @@
} ]
},
"post" : {
+ "requestBody" : {
+ "content" : {
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
+ }
+ },
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v31/core/OAR044/media-type.yaml b/src/test/resources/checks/v31/core/OAR044/media-type.yaml
index 67d72d30..23fe935e 100644
--- a/src/test/resources/checks/v31/core/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v31/core/OAR044/media-type.yaml
@@ -24,6 +24,21 @@ paths:
- name: otherParam
in: path
post:
+ requestBody:
+ content:
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v31/examples/OAR031/externalref.yaml b/src/test/resources/checks/v31/examples/OAR031/externalref.yaml
index 21cee27e..4e6e96e7 100644
--- a/src/test/resources/checks/v31/examples/OAR031/externalref.yaml
+++ b/src/test/resources/checks/v31/examples/OAR031/externalref.yaml
@@ -14,7 +14,7 @@ paths:
summary: Get all users
description: Returns a list of users.
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A JSON array of user objects
content:
application/json:
@@ -40,7 +40,7 @@ paths:
name: Puppy
type: dog
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A single user object
content:
application/json:
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
index bf96e975..c48f0f18 100644
--- a/src/test/resources/checks/v31/examples/OAR031/nested-properties-examples.yaml
+++ b/src/test/resources/checks/v31/examples/OAR031/nested-properties-examples.yaml
@@ -6,7 +6,7 @@ paths:
/profile:
put:
summary: Update user profile
- requestBody:
+ requestBody: # Noncompliant {{OAR031: Request body must have one or more examples defined}}
required: true
content:
application/json:
diff --git a/src/test/resources/checks/v31/format/OAR037/complete.json b/src/test/resources/checks/v31/format/OAR037/complete.json
index 8c943299..6584f397 100644
--- a/src/test/resources/checks/v31/format/OAR037/complete.json
+++ b/src/test/resources/checks/v31/format/OAR037/complete.json
@@ -10,7 +10,7 @@
"in": "header",
"name": "paramOne",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
},
@@ -18,7 +18,7 @@
"in": "header",
"name": "paramTwo",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -34,7 +34,7 @@
"in": "header",
"name": "paramThree",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -54,7 +54,15 @@
"type": "object",
"properties": {
"without": {
- "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string" # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ },
+ "withPattern": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
+ },
+ "withInvalidPattern": {
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern": "["
},
"date": {
"type": "string",
@@ -101,7 +109,7 @@
"format": "ipv6"
},
"other": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
diff --git a/src/test/resources/checks/v31/format/OAR037/complete.yaml b/src/test/resources/checks/v31/format/OAR037/complete.yaml
index 769a4793..e75afc02 100644
--- a/src/test/resources/checks/v31/format/OAR037/complete.yaml
+++ b/src/test/resources/checks/v31/format/OAR037/complete.yaml
@@ -8,13 +8,13 @@ components:
in: header
name: paramOne
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paramTwo:
in: header
name: paramTwo
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paths:
/invoices:
@@ -23,7 +23,7 @@ paths:
- in: header
name: paramThree
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
get:
parameters:
@@ -37,7 +37,13 @@ paths:
type: object
properties:
without:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ withPattern:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
+ withInvalidPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: '['
date:
type: string
format: date
@@ -72,5 +78,5 @@ paths:
type: string
format: ipv6
other:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
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
index 7d632201..5fc02cb9 100644
--- a/src/test/resources/checks/v31/format/OAR037/nested.json
+++ b/src/test/resources/checks/v31/format/OAR037/nested.json
@@ -19,8 +19,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v31/format/OAR037/nested.yaml b/src/test/resources/checks/v31/format/OAR037/nested.yaml
index 4a1accb7..302751f2 100644
--- a/src/test/resources/checks/v31/format/OAR037/nested.yaml
+++ b/src/test/resources/checks/v31/format/OAR037/nested.yaml
@@ -17,6 +17,9 @@ paths:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v31/format/OAR037/with-$ref.json b/src/test/resources/checks/v31/format/OAR037/with-$ref.json
index d5ed29ea..0e0d12bc 100644
--- a/src/test/resources/checks/v31/format/OAR037/with-$ref.json
+++ b/src/test/resources/checks/v31/format/OAR037/with-$ref.json
@@ -37,8 +37,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml
index b6437060..36a92461 100644
--- a/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml
+++ b/src/test/resources/checks/v31/format/OAR037/with-$ref.yaml
@@ -25,5 +25,8 @@ components:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v31/format/OAR044/media-type.json b/src/test/resources/checks/v31/format/OAR044/media-type.json
index 86ec986a..05232934 100644
--- a/src/test/resources/checks/v31/format/OAR044/media-type.json
+++ b/src/test/resources/checks/v31/format/OAR044/media-type.json
@@ -32,12 +32,26 @@
"requestBody" : {
"content" : {
"application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
- "text/*" : { }
+ "text/*" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
}
},
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v31/format/OAR044/media-type.yaml b/src/test/resources/checks/v31/format/OAR044/media-type.yaml
index 60015c9b..71f903d8 100644
--- a/src/test/resources/checks/v31/format/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v31/format/OAR044/media-type.yaml
@@ -23,6 +23,19 @@ paths:
content:
'application': { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
'text/*': { }
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v31/operations/OAR017/plain.yaml b/src/test/resources/checks/v31/operations/OAR017/plain.yaml
index 72bb577e..9ad95cf0 100644
--- a/src/test/resources/checks/v31/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v31/operations/OAR017/plain.yaml
@@ -43,3 +43,8 @@ paths:
responses:
200:
description: Ok
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR019/excluded.yaml b/src/test/resources/checks/v31/parameters/OAR019/excluded.yaml
index 8a1c820c..67391c40 100644
--- a/src/test/resources/checks/v31/parameters/OAR019/excluded.yaml
+++ b/src/test/resources/checks/v31/parameters/OAR019/excluded.yaml
@@ -3,7 +3,7 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /another:
+ /status:
get:
parameters:
- in: query
diff --git a/src/test/resources/checks/v31/parameters/OAR022/single-resource.json b/src/test/resources/checks/v31/parameters/OAR022/single-resource.json
new file mode 100644
index 00000000..68f78709
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR022/single-resource.yaml b/src/test/resources/checks/v31/parameters/OAR022/single-resource.yaml
new file mode 100644
index 00000000..6e692751
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR022/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/parameters/OAR025/single-resource.json b/src/test/resources/checks/v31/parameters/OAR025/single-resource.json
new file mode 100644
index 00000000..68f78709
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.1.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v31/parameters/OAR025/single-resource.yaml b/src/test/resources/checks/v31/parameters/OAR025/single-resource.yaml
new file mode 100644
index 00000000..6e692751
--- /dev/null
+++ b/src/test/resources/checks/v31/parameters/OAR025/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.1.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v31/resources/OAR017/plain.yaml b/src/test/resources/checks/v31/resources/OAR017/plain.yaml
index 87dee561..674c3d0c 100644
--- a/src/test/resources/checks/v31/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v31/resources/OAR017/plain.yaml
@@ -56,3 +56,9 @@ paths:
responses:
200:
description: Ok
+
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/core/OAR044/media-type.json b/src/test/resources/checks/v32/core/OAR044/media-type.json
index 517db4d8..9b7f036f 100644
--- a/src/test/resources/checks/v32/core/OAR044/media-type.json
+++ b/src/test/resources/checks/v32/core/OAR044/media-type.json
@@ -34,9 +34,27 @@
} ]
},
"post" : {
+ "requestBody" : {
+ "content" : {
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
+ }
+ },
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v32/core/OAR044/media-type.yaml b/src/test/resources/checks/v32/core/OAR044/media-type.yaml
index 22b32de1..bde8534c 100644
--- a/src/test/resources/checks/v32/core/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v32/core/OAR044/media-type.yaml
@@ -24,6 +24,21 @@ paths:
- name: otherParam
in: path
post:
+ requestBody:
+ content:
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v32/examples/OAR031/externalref.yaml b/src/test/resources/checks/v32/examples/OAR031/externalref.yaml
index 126feb8a..2c326a8b 100644
--- a/src/test/resources/checks/v32/examples/OAR031/externalref.yaml
+++ b/src/test/resources/checks/v32/examples/OAR031/externalref.yaml
@@ -14,7 +14,7 @@ paths:
summary: Get all users
description: Returns a list of users.
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A JSON array of user objects
content:
application/json:
@@ -40,7 +40,7 @@ paths:
name: Puppy
type: dog
responses:
- '200':
+ '200': # Noncompliant {{OAR031: Responses must have one or more examples defined}}
description: A single user object
content:
application/json:
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
index 34233555..e93c96a9 100644
--- a/src/test/resources/checks/v32/examples/OAR031/nested-properties-examples.yaml
+++ b/src/test/resources/checks/v32/examples/OAR031/nested-properties-examples.yaml
@@ -6,7 +6,7 @@ paths:
/profile:
put:
summary: Update user profile
- requestBody:
+ requestBody: # Noncompliant {{OAR031: Request body must have one or more examples defined}}
required: true
content:
application/json:
diff --git a/src/test/resources/checks/v32/format/OAR037/complete.json b/src/test/resources/checks/v32/format/OAR037/complete.json
index 4b9f4508..74f1adcd 100644
--- a/src/test/resources/checks/v32/format/OAR037/complete.json
+++ b/src/test/resources/checks/v32/format/OAR037/complete.json
@@ -10,7 +10,7 @@
"in": "header",
"name": "paramOne",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
},
@@ -18,7 +18,7 @@
"in": "header",
"name": "paramTwo",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -34,7 +34,7 @@
"in": "header",
"name": "paramThree",
"schema": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
@@ -54,7 +54,15 @@
"type": "object",
"properties": {
"without": {
- "type": "string" # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string" # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ },
+ "withPattern": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
+ },
+ "withInvalidPattern": {
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ "pattern": "["
},
"date": {
"type": "string",
@@ -101,7 +109,7 @@
"format": "ipv6"
},
"other": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
}
}
diff --git a/src/test/resources/checks/v32/format/OAR037/complete.yaml b/src/test/resources/checks/v32/format/OAR037/complete.yaml
index 2be1bfa4..0e7f4cc7 100644
--- a/src/test/resources/checks/v32/format/OAR037/complete.yaml
+++ b/src/test/resources/checks/v32/format/OAR037/complete.yaml
@@ -8,13 +8,13 @@ components:
in: header
name: paramOne
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paramTwo:
in: header
name: paramTwo
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
paths:
/invoices:
@@ -23,7 +23,7 @@ paths:
- in: header
name: paramThree
schema:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
get:
parameters:
@@ -37,7 +37,13 @@ paths:
type: object
properties:
without:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ withPattern:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
+ withInvalidPattern:
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
+ pattern: '['
date:
type: string
format: date
@@ -72,5 +78,5 @@ paths:
type: string
format: ipv6
other:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
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
index 08aa7e31..74e72c00 100644
--- a/src/test/resources/checks/v32/format/OAR037/nested.json
+++ b/src/test/resources/checks/v32/format/OAR037/nested.json
@@ -19,8 +19,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v32/format/OAR037/nested.yaml b/src/test/resources/checks/v32/format/OAR037/nested.yaml
index 8a2d2c6b..a6fd15be 100644
--- a/src/test/resources/checks/v32/format/OAR037/nested.yaml
+++ b/src/test/resources/checks/v32/format/OAR037/nested.yaml
@@ -17,6 +17,9 @@ paths:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v32/format/OAR037/with-$ref.json b/src/test/resources/checks/v32/format/OAR037/with-$ref.json
index d88ad1bc..0589c17f 100644
--- a/src/test/resources/checks/v32/format/OAR037/with-$ref.json
+++ b/src/test/resources/checks/v32/format/OAR037/with-$ref.json
@@ -37,8 +37,12 @@
"type": "object",
"properties": {
"value": {
- "type": "string", # Noncompliant {{OAR037: String types requires a valid format}}
+ "type": "string", # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
"format": "YYYY-MM-DD"
+ },
+ "code": {
+ "type": "string",
+ "pattern": "^[A-Z]{3}-[0-9]+$"
}
}
}
diff --git a/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml b/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml
index 40f2fc10..b631e251 100644
--- a/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml
+++ b/src/test/resources/checks/v32/format/OAR037/with-$ref.yaml
@@ -25,5 +25,8 @@ components:
type: object
properties:
value:
- type: string # Noncompliant {{OAR037: String types requires a valid format}}
+ type: string # Noncompliant {{OAR037: String types require a valid format, or a valid pattern when no format is defined}}
format: YYYY-MM-DD
+ code:
+ type: string
+ pattern: '^[A-Z]{3}-[0-9]+$'
diff --git a/src/test/resources/checks/v32/format/OAR044/media-type.json b/src/test/resources/checks/v32/format/OAR044/media-type.json
index a37e77ee..0251e212 100644
--- a/src/test/resources/checks/v32/format/OAR044/media-type.json
+++ b/src/test/resources/checks/v32/format/OAR044/media-type.json
@@ -32,12 +32,26 @@
"requestBody" : {
"content" : {
"application" : { }, # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
- "text/*" : { }
+ "text/*" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/ld+json" : { },
+ "image/*" : { },
+ "*/*" : { }
}
},
"responses" : {
"200" : {
- "description" : "some operation"
+ "description" : "some operation",
+ "content" : {
+ "application/json" : { },
+ "text/csv" : { },
+ "image/png" : { },
+ "application/vnd.ms-excel" : { },
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" : { },
+ "application/vnd.github+json" : { },
+ "text/plain; charset=utf-8" : { }
+ }
}
}
}
diff --git a/src/test/resources/checks/v32/format/OAR044/media-type.yaml b/src/test/resources/checks/v32/format/OAR044/media-type.yaml
index 4dc3378b..6e1cbd7d 100644
--- a/src/test/resources/checks/v32/format/OAR044/media-type.yaml
+++ b/src/test/resources/checks/v32/format/OAR044/media-type.yaml
@@ -23,6 +23,19 @@ paths:
content:
'application': { } # Noncompliant {{OAR044: Declared media type range should conform to RFC7231}}
'text/*': { }
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/ld+json': {}
+ 'image/*': {}
+ '*/*': {}
responses:
- '200':
- description: some operation
+ '200':
+ description: some operation
+ content:
+ 'application/json': {}
+ 'text/csv': {}
+ 'image/png': {}
+ 'application/vnd.ms-excel': {}
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': {}
+ 'application/vnd.github+json': {}
+ 'text/plain; charset=utf-8': {}
diff --git a/src/test/resources/checks/v32/operations/OAR017/plain.yaml b/src/test/resources/checks/v32/operations/OAR017/plain.yaml
index a623de5e..8c115f7b 100644
--- a/src/test/resources/checks/v32/operations/OAR017/plain.yaml
+++ b/src/test/resources/checks/v32/operations/OAR017/plain.yaml
@@ -43,3 +43,8 @@ paths:
responses:
200:
description: Ok
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml b/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml
index 8a15d474..387db41b 100644
--- a/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml
+++ b/src/test/resources/checks/v32/parameters/OAR019/excluded.yaml
@@ -3,7 +3,7 @@ info:
version: 1.0.0
title: Swagger Petstore
paths:
- /another:
+ /status:
get:
parameters:
- in: query
diff --git a/src/test/resources/checks/v32/parameters/OAR022/single-resource.json b/src/test/resources/checks/v32/parameters/OAR022/single-resource.json
new file mode 100644
index 00000000..d08f568f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR022/single-resource.yaml b/src/test/resources/checks/v32/parameters/OAR022/single-resource.yaml
new file mode 100644
index 00000000..b2a320f5
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR022/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/parameters/OAR025/single-resource.json b/src/test/resources/checks/v32/parameters/OAR025/single-resource.json
new file mode 100644
index 00000000..d08f568f
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/single-resource.json
@@ -0,0 +1,25 @@
+{
+ "openapi" : "3.2.0",
+ "info" : {
+ "version" : "1.0.0",
+ "title" : "Swagger Petstore"
+ },
+ "paths" : {
+ "/examples/{id}" : {
+ "get" : {
+ "parameters" : [ {
+ "in" : "query",
+ "name" : "other",
+ "schema" : {
+ "type" : "string"
+ }
+ } ],
+ "responses" : {
+ "206" : {
+ "description" : "Ok"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/test/resources/checks/v32/parameters/OAR025/single-resource.yaml b/src/test/resources/checks/v32/parameters/OAR025/single-resource.yaml
new file mode 100644
index 00000000..b2a320f5
--- /dev/null
+++ b/src/test/resources/checks/v32/parameters/OAR025/single-resource.yaml
@@ -0,0 +1,15 @@
+openapi: "3.2.0"
+info:
+ version: 1.0.0
+ title: Swagger Petstore
+paths:
+ /examples/{id}:
+ get:
+ parameters:
+ - in: query
+ name: other
+ schema:
+ type: string
+ responses:
+ 206:
+ description: Ok
diff --git a/src/test/resources/checks/v32/resources/OAR017/plain.yaml b/src/test/resources/checks/v32/resources/OAR017/plain.yaml
index d3e714b9..baa25013 100644
--- a/src/test/resources/checks/v32/resources/OAR017/plain.yaml
+++ b/src/test/resources/checks/v32/resources/OAR017/plain.yaml
@@ -56,3 +56,9 @@ paths:
responses:
200:
description: Ok
+
+ /one/delete:
+ post:
+ responses:
+ 200:
+ description: Ok