From 544bca9323063efb761d24214f2f6edb6b68c278 Mon Sep 17 00:00:00 2001 From: Aldo Torres Date: Thu, 13 Nov 2025 17:06:34 -0500 Subject: [PATCH 1/3] fixing show mime types into post,put or patch verbs --- pom.xml | 14 +++++- .../format/AbstractDefaultMediaTypeCheck.java | 46 ++++++++++--------- .../AbstractUndefinedMediaTypeCheck.java | 24 ++++++---- .../OAR006/with-default-and-specific.json | 2 +- .../OAR006/with-default-and-specific.yaml | 2 +- .../checks/v2/format/OAR006/with-default.json | 2 +- .../checks/v2/format/OAR006/with-default.yaml | 2 +- .../v2/format/OAR006/with-specific.json | 2 +- .../v2/format/OAR006/with-specific.yaml | 2 +- .../v2/format/OAR006/without-anything.json | 2 +- .../v2/format/OAR006/without-anything.yaml | 2 +- .../OAR009/with-default-and-specific.json | 2 +- .../OAR009/with-default-and-specific.yaml | 2 +- .../checks/v2/format/OAR009/with-default.json | 2 +- .../checks/v2/format/OAR009/with-default.yaml | 2 +- .../v2/format/OAR009/with-specific.json | 4 +- .../v2/format/OAR009/with-specific.yaml | 4 +- .../with-wrong-default-and-specific.json | 4 +- .../with-wrong-default-and-specific.yaml | 4 +- .../v2/format/OAR009/with-wrong-default.json | 2 +- .../v2/format/OAR009/with-wrong-default.yaml | 2 +- .../v2/format/OAR009/without-anything.json | 2 +- .../v2/format/OAR009/without-anything.yaml | 2 +- 23 files changed, 76 insertions(+), 56 deletions(-) diff --git a/pom.xml b/pom.xml index b3e963f6..3305bd55 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ - + + + + org.sonatype.central + central-publishing-maven-plugin + 0.8.0 + true + + central + true + published + 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 41e70839..a82a2504 100644 --- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java +++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractDefaultMediaTypeCheck.java @@ -1,22 +1,21 @@ package apiaddicts.sonar.openapi.checks.format; +import apiaddicts.sonar.openapi.checks.BaseCheck; +import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.isExternalRef; +import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.resolve; import com.google.common.collect.ImmutableSet; import com.sonar.sslr.api.AstNode; import com.sonar.sslr.api.AstNodeType; -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 apiaddicts.sonar.openapi.checks.BaseCheck; -import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode; - import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.*; +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.RuleProperty; public abstract class AbstractDefaultMediaTypeCheck extends BaseCheck { @@ -74,18 +73,23 @@ public void visitNode(JsonNode node) { } private void visitV2Node(JsonNode node) { - JsonNode sectionNode = node.get(section); - boolean definesMimeTypes = !sectionNode.isMissing(); - - if (definesMimeTypes) { - if (!supportsDefaultMimeTypeV2(node)) { - addIssue(key, message, sectionNode.key()); - } - } else { - if (!globalSupportsDefaultMimeType) { - addIssue(key, message, node.key()); - } - } + if(node.getType() == OpenApi2Grammar.OPERATION){ + String operation = node.key().getTokenValue().toLowerCase(); + if (operation.equals("post") || operation.equals("put") || operation.equals("patch")){ + JsonNode sectionNode = node.get(section); + boolean definesMimeTypes = !sectionNode.isMissing(); + + if (definesMimeTypes) { + if (!supportsDefaultMimeTypeV2(node)) { + addIssue(key, message, sectionNode.key()); + } + } else { + if (!globalSupportsDefaultMimeType) { + addIssue(key, message, node.key()); + } + } + } + } } private void visitV3Node(JsonNode node) { 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 92ee53c3..6881f92e 100644 --- a/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java +++ b/src/main/java/apiaddicts/sonar/openapi/checks/format/AbstractUndefinedMediaTypeCheck.java @@ -1,19 +1,18 @@ package apiaddicts.sonar.openapi.checks.format; +import apiaddicts.sonar.openapi.checks.BaseCheck; +import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.isExternalRef; +import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.resolve; import com.google.common.collect.ImmutableSet; 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 apiaddicts.sonar.openapi.checks.BaseCheck; -import org.apiaddicts.apitools.dosonarapi.sslr.yaml.grammar.JsonNode; - import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; - -import static apiaddicts.sonar.openapi.utils.JsonNodeUtils.*; +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; public abstract class AbstractUndefinedMediaTypeCheck extends BaseCheck { @@ -49,8 +48,13 @@ public void visitNode(JsonNode node) { } private void visitV2Node(JsonNode node) { - if (!globalDefinesMediaTypes && !definesMimeTypesV2(node)) { - addIssue(key, translate(MESSAGE, section), node.key()); + if(node.getType() == OpenApi2Grammar.OPERATION){ + String operation = node.key().getTokenValue().toLowerCase(); + if (operation.equals("post") || operation.equals("put") || operation.equals("patch")){ + if (!globalDefinesMediaTypes && !definesMimeTypesV2(node)) { + addIssue(key, translate(MESSAGE, section), node.key()); + } + } } } diff --git a/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.json b/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.json index d7e9ef98..53f6f9ba 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.json +++ b/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "consumes": [ "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.yaml b/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.yaml index 7b549975..01065011 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR006/with-default-and-specific.yaml @@ -6,7 +6,7 @@ consumes: - application/json paths: /pets: - get: + post: consumes: - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR006/with-default.json b/src/test/resources/checks/v2/format/OAR006/with-default.json index c5fae1b0..0b4c4aa5 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-default.json +++ b/src/test/resources/checks/v2/format/OAR006/with-default.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR006/with-default.yaml b/src/test/resources/checks/v2/format/OAR006/with-default.yaml index ca54cf9a..f2cb28da 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-default.yaml +++ b/src/test/resources/checks/v2/format/OAR006/with-default.yaml @@ -6,7 +6,7 @@ consumes: - application/json paths: /pets: - get: + post: responses: 200: description: Ok \ No newline at end of file diff --git a/src/test/resources/checks/v2/format/OAR006/with-specific.json b/src/test/resources/checks/v2/format/OAR006/with-specific.json index 84ebfa31..46495abd 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-specific.json +++ b/src/test/resources/checks/v2/format/OAR006/with-specific.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { + "post": { "consumes": [ "application/json" ], diff --git a/src/test/resources/checks/v2/format/OAR006/with-specific.yaml b/src/test/resources/checks/v2/format/OAR006/with-specific.yaml index ff3a259e..abeb358d 100644 --- a/src/test/resources/checks/v2/format/OAR006/with-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR006/with-specific.yaml @@ -5,7 +5,7 @@ info: paths: /pets: - get: + post: consumes: - application/json responses: diff --git a/src/test/resources/checks/v2/format/OAR006/without-anything.json b/src/test/resources/checks/v2/format/OAR006/without-anything.json index ef8d7d70..a0356fc3 100644 --- a/src/test/resources/checks/v2/format/OAR006/without-anything.json +++ b/src/test/resources/checks/v2/format/OAR006/without-anything.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { # Noncompliant {{OAR006: Section consumes is mandatory}} + "post": { # Noncompliant {{OAR006: Section consumes is mandatory}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR006/without-anything.yaml b/src/test/resources/checks/v2/format/OAR006/without-anything.yaml index 2c075c6b..e8dc87e7 100644 --- a/src/test/resources/checks/v2/format/OAR006/without-anything.yaml +++ b/src/test/resources/checks/v2/format/OAR006/without-anything.yaml @@ -4,7 +4,7 @@ info: title: Swagger Petstore paths: /pets: - get: # Noncompliant {{OAR006: Section consumes is mandatory}} + post: # Noncompliant {{OAR006: Section consumes is mandatory}} responses: 200: description: Ok \ No newline at end of file diff --git a/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.json b/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.json index 39cff17c..e881405a 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.json +++ b/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "consumes": [ # Noncompliant {{OAR009: Should indicate the default request media type}} "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.yaml b/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.yaml index f8f96fb2..3c8b5cd8 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR009/with-default-and-specific.yaml @@ -6,7 +6,7 @@ consumes: - application/json paths: /pets: - get: + post: consumes: # Noncompliant {{OAR009: Should indicate the default request media type}} - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR009/with-default.json b/src/test/resources/checks/v2/format/OAR009/with-default.json index c5fae1b0..0b4c4aa5 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-default.json +++ b/src/test/resources/checks/v2/format/OAR009/with-default.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR009/with-default.yaml b/src/test/resources/checks/v2/format/OAR009/with-default.yaml index ca54cf9a..f2cb28da 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-default.yaml +++ b/src/test/resources/checks/v2/format/OAR009/with-default.yaml @@ -6,7 +6,7 @@ consumes: - application/json paths: /pets: - get: + post: responses: 200: description: Ok \ No newline at end of file diff --git a/src/test/resources/checks/v2/format/OAR009/with-specific.json b/src/test/resources/checks/v2/format/OAR009/with-specific.json index eb77a8a7..032d2d57 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-specific.json +++ b/src/test/resources/checks/v2/format/OAR009/with-specific.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { + "post": { "consumes": [ "application/json" ], @@ -18,7 +18,7 @@ } }, "/owners": { - "get": { + "post": { "consumes": [ # Noncompliant {{OAR009: Should indicate the default request media type}} "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR009/with-specific.yaml b/src/test/resources/checks/v2/format/OAR009/with-specific.yaml index 3addd141..05f77db9 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR009/with-specific.yaml @@ -5,14 +5,14 @@ info: paths: /pets: - get: + post: consumes: - application/json responses: 200: description: Ok /owners: - get: + post: consumes: # Noncompliant {{OAR009: Should indicate the default request media type}} - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.json b/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.json index ea01575f..13769fa3 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.json +++ b/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "consumes": [ # Noncompliant {{OAR009: Should indicate the default request media type}} "application/xml" ], @@ -21,7 +21,7 @@ } }, "/owners": { - "get": { + "post": { "consumes": [ "application/json" ], diff --git a/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.yaml index 550cd757..ceef0f0e 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR009/with-wrong-default-and-specific.yaml @@ -6,14 +6,14 @@ consumes: - application/xml paths: /pets: - get: + post: consumes: # Noncompliant {{OAR009: Should indicate the default request media type}} - application/xml responses: 200: description: Ok /owners: - get: + post: consumes: - application/json responses: diff --git a/src/test/resources/checks/v2/format/OAR009/with-wrong-default.json b/src/test/resources/checks/v2/format/OAR009/with-wrong-default.json index d105521a..2bf93739 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-wrong-default.json +++ b/src/test/resources/checks/v2/format/OAR009/with-wrong-default.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { # Noncompliant {{OAR009: Should indicate the default request media type}} + "post": { # Noncompliant {{OAR009: Should indicate the default request media type}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR009/with-wrong-default.yaml b/src/test/resources/checks/v2/format/OAR009/with-wrong-default.yaml index 7be46a47..2fab8fc3 100644 --- a/src/test/resources/checks/v2/format/OAR009/with-wrong-default.yaml +++ b/src/test/resources/checks/v2/format/OAR009/with-wrong-default.yaml @@ -6,7 +6,7 @@ consumes: - application/xml paths: /pets: - get: # Noncompliant {{OAR009: Should indicate the default request media type}} + 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/v2/format/OAR009/without-anything.json b/src/test/resources/checks/v2/format/OAR009/without-anything.json index 73a5965f..9adb2d61 100644 --- a/src/test/resources/checks/v2/format/OAR009/without-anything.json +++ b/src/test/resources/checks/v2/format/OAR009/without-anything.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { # Noncompliant {{OAR009: Should indicate the default request media type}} + "post": { # Noncompliant {{OAR009: Should indicate the default request media type}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR009/without-anything.yaml b/src/test/resources/checks/v2/format/OAR009/without-anything.yaml index 8d7f1050..d10760a0 100644 --- a/src/test/resources/checks/v2/format/OAR009/without-anything.yaml +++ b/src/test/resources/checks/v2/format/OAR009/without-anything.yaml @@ -4,7 +4,7 @@ info: title: Swagger Petstore paths: /pets: - get: # Noncompliant {{OAR009: Should indicate the default request media type}} + post: # Noncompliant {{OAR009: Should indicate the default request media type}} responses: 200: description: Ok \ No newline at end of file From 4ef53882ff0a4cb6a1cbfada063b5ba65245eb23 Mon Sep 17 00:00:00 2001 From: Aldo Torres Date: Wed, 19 Nov 2025 15:55:50 -0500 Subject: [PATCH 2/3] revert pom --- pom.xml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 3305bd55..b3e963f6 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ - - - - org.sonatype.central - central-publishing-maven-plugin - 0.8.0 - true - - central - true - published - From d920e68e020a19911e7e37e0305640df5b45a1a2 Mon Sep 17 00:00:00 2001 From: Aldo Torres Date: Thu, 20 Nov 2025 11:46:34 -0500 Subject: [PATCH 3/3] solving test issues --- .../resources/checks/v2/format/OAR007/without-anything.json | 2 +- .../resources/checks/v2/format/OAR007/without-anything.yaml | 2 +- .../checks/v2/format/OAR010/with-default-and-specific.json | 2 +- .../checks/v2/format/OAR010/with-default-and-specific.yaml | 2 +- src/test/resources/checks/v2/format/OAR010/with-specific.json | 2 +- src/test/resources/checks/v2/format/OAR010/with-specific.yaml | 2 +- .../v2/format/OAR010/with-wrong-default-and-specific.json | 2 +- .../v2/format/OAR010/with-wrong-default-and-specific.yaml | 2 +- .../resources/checks/v2/format/OAR010/with-wrong-default.json | 2 +- .../resources/checks/v2/format/OAR010/with-wrong-default.yaml | 2 +- .../resources/checks/v2/format/OAR010/without-anything.json | 2 +- .../resources/checks/v2/format/OAR010/without-anything.yaml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/test/resources/checks/v2/format/OAR007/without-anything.json b/src/test/resources/checks/v2/format/OAR007/without-anything.json index 1e18189b..9363e37d 100644 --- a/src/test/resources/checks/v2/format/OAR007/without-anything.json +++ b/src/test/resources/checks/v2/format/OAR007/without-anything.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { # Noncompliant {{OAR007: Section produces is mandatory}} + "post": { # Noncompliant {{OAR007: Section produces is mandatory}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR007/without-anything.yaml b/src/test/resources/checks/v2/format/OAR007/without-anything.yaml index 8cb5e5fd..85df5469 100644 --- a/src/test/resources/checks/v2/format/OAR007/without-anything.yaml +++ b/src/test/resources/checks/v2/format/OAR007/without-anything.yaml @@ -4,7 +4,7 @@ info: title: Swagger Petstore paths: /pets: - get: # Noncompliant {{OAR007: Section produces is mandatory}} + post: # Noncompliant {{OAR007: Section produces is mandatory}} responses: 200: description: Ok \ No newline at end of file diff --git a/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.json b/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.json index 684b14db..a497e839 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.json +++ b/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "produces": [ # Noncompliant {{OAR010: Should indicate the default response media type}} "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.yaml b/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.yaml index 292c5fd9..44eb8c34 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR010/with-default-and-specific.yaml @@ -6,7 +6,7 @@ produces: - application/json paths: /pets: - get: + post: produces: # Noncompliant {{OAR010: Should indicate the default response media type}} - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR010/with-specific.json b/src/test/resources/checks/v2/format/OAR010/with-specific.json index ea69febc..fb822248 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-specific.json +++ b/src/test/resources/checks/v2/format/OAR010/with-specific.json @@ -18,7 +18,7 @@ } }, "/owners": { - "get": { + "post": { "produces": [ # Noncompliant {{OAR010: Should indicate the default response media type}} "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR010/with-specific.yaml b/src/test/resources/checks/v2/format/OAR010/with-specific.yaml index 0077203b..0909c695 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR010/with-specific.yaml @@ -12,7 +12,7 @@ paths: 200: description: Ok /owners: - get: + post: produces: # Noncompliant {{OAR010: Should indicate the default response media type}} - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.json b/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.json index 191f453f..0b983b0e 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.json +++ b/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { + "post": { "produces": [ # Noncompliant {{OAR010: Should indicate the default response media type}} "application/xml" ], diff --git a/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.yaml b/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.yaml index d4aba397..47f71f97 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.yaml +++ b/src/test/resources/checks/v2/format/OAR010/with-wrong-default-and-specific.yaml @@ -6,7 +6,7 @@ produces: - application/xml paths: /pets: - get: + post: produces: # Noncompliant {{OAR010: Should indicate the default response media type}} - application/xml responses: diff --git a/src/test/resources/checks/v2/format/OAR010/with-wrong-default.json b/src/test/resources/checks/v2/format/OAR010/with-wrong-default.json index 6d92362c..31975dd3 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-wrong-default.json +++ b/src/test/resources/checks/v2/format/OAR010/with-wrong-default.json @@ -9,7 +9,7 @@ ], "paths": { "/pets": { - "get": { # Noncompliant {{OAR010: Should indicate the default response media type}} + "post": { # Noncompliant {{OAR010: Should indicate the default response media type}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR010/with-wrong-default.yaml b/src/test/resources/checks/v2/format/OAR010/with-wrong-default.yaml index b5ebf147..3d3126c7 100644 --- a/src/test/resources/checks/v2/format/OAR010/with-wrong-default.yaml +++ b/src/test/resources/checks/v2/format/OAR010/with-wrong-default.yaml @@ -6,7 +6,7 @@ produces: - application/xml paths: /pets: - get: # Noncompliant {{OAR010: Should indicate the default response media type}} + post: # Noncompliant {{OAR010: Should indicate the default response media type}} responses: 200: description: Ok \ No newline at end of file diff --git a/src/test/resources/checks/v2/format/OAR010/without-anything.json b/src/test/resources/checks/v2/format/OAR010/without-anything.json index a6f89373..0024fa04 100644 --- a/src/test/resources/checks/v2/format/OAR010/without-anything.json +++ b/src/test/resources/checks/v2/format/OAR010/without-anything.json @@ -6,7 +6,7 @@ }, "paths": { "/pets": { - "get": { # Noncompliant {{OAR010: Should indicate the default response media type}} + "post": { # Noncompliant {{OAR010: Should indicate the default response media type}} "responses": { "200": { "description": "Ok" diff --git a/src/test/resources/checks/v2/format/OAR010/without-anything.yaml b/src/test/resources/checks/v2/format/OAR010/without-anything.yaml index 3db04b5f..ba4cf83c 100644 --- a/src/test/resources/checks/v2/format/OAR010/without-anything.yaml +++ b/src/test/resources/checks/v2/format/OAR010/without-anything.yaml @@ -4,7 +4,7 @@ info: title: Swagger Petstore paths: /pets: - get: # Noncompliant {{OAR010: Should indicate the default response media type}} + post: # Noncompliant {{OAR010: Should indicate the default response media type}} responses: 200: description: Ok \ No newline at end of file